-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Per-group (e.g. legendgroup) trace styling #2744
Comments
You're correct, that ability doesn't exist today. I like the idea, and in v2 we could consider making this the default behavior, but for now it would need to be opt-in. Something like |
Yes, that would be very convenient. Do I understand well that the first trace in the |
This issue also probably belongs in https://github.com/plotly/plotly.py rather than plotly.js, right? |
Well, you probably know better than I - still, the rationale for reporting here is that it is a question on the API, not on the python wrappers. |
@jacobq The example is in Python, but any change to the trace properties would need to be implemented in Plotly.js first. Then plotly.py will get it automatically. |
any update as of October 2018. |
This would be great for subplots showing different data from the same elements. I'm having problems trying to workarround this. |
I would love this feature too. |
Created a github account just to pile on. The way plotly currently works for this issue goes against the expected behavior, compared to most other common statistical / graphing programs I've used. Grouped legends is a crutch, but then manually setting colors and setting showlegend to false for an arbitrary number of traces becomes programmatically cumbersome. This is a major hassle when programming a dashboard for even simple data. |
For anyone still encountering this issue and looking for a work around I'd suggest generating a color value based on a hash of your group name as per this stack exchange as per this stack exchange. If you have similar group names (i.e group01, group 02, ...) you may want to consider shuffling or reversing your string to get clearly different values. This method has the advantage that using the hash function you can easily use the same color outside of the ploty ecosystem. |
Piling up on this as well. Would love to have the option to share the same style for the same legend groups. This is very useful, for example, when showing the values and limits for the same datum. |
Any update on enabling this feature? |
The following approach worked for me:
|
This issue has been tagged with A community PR for this feature would certainly be welcome, but our experience is deeper features like this are difficult to complete without the Plotly maintainers leading the effort. Sponsorship range: $10k-$15k What Sponsorship includes:
Please include the link to this issue when contacting us to discuss. |
I needed this for an arbitrary number of groups but in that case it is not practical to define a color list. |
Thanks! This is by far the fastest work-around I've tried. For python, here's a module that hash strings into hex color code directly: |
Hi - this issue has been sitting for a while, so as part of our effort to tidy up our public repositories I'm going to close it. If it's still a concern, we'd be grateful if you could open a new issue (with a short reproducible example if appropriate) so that we can add it to our stack. Cheers - @gvwilson |
If I want two traces on two sub-plots to share the same legend, I (think I) have to explicitly specify the trace color, like
One issue with the above is that I lose the default plotly colors (see plotly/plotly.py#1026 for getting them back).
Is there a more generic way to tell plotly that two traces should share the same legend/style, or even count as one? Thanks
The text was updated successfully, but these errors were encountered: