-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Label color in legend #1701
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
Comments
That would be nice. I would prefer this being part of more general legend item style attributes then a one-off boolean, but oh well. Here's a workaround in the meantime: https://codepen.io/etpinard/pen/ybRyVp?editors=0010 |
Thanks! Cheers |
That could work. But I would prefer putting these options in a trace attribute container that way it would be compatible with other legend item styling feature requests (e.g. #2080). For example, {
x: [/* */],
y: [/* */],
legenditem: {
textfont: {
color: 'red'
},
marker: {
size: 20 // see https://github.com/plotly/plotly.js/issues/2080
}
}
} But then again, maybe this is the wrong approach altogether. @alexcjohnson thinks that legend items should be special version of annotations. |
Just wanted to add one thought to the discussion. It would be nice to make it possible to change text of the labels (so it can be something different than data name), not just fonts/colors/sizes. Maybe it's good idea to move legend options from traces to layout (?) object, something like:
This would also allow us to create a 'group' of certain data items as a single item on the legend. Not just visually (like current legendgroup property on a trace), but physically displayed as one label on legend. I think disconnecting legend settings from trace object should also make legend more flexible and easier to maintain - no need to track group names on trace object, possibility to specify ordering of elements on legend etc. How do you feel about that, @etpinard, @alexcjohnson ? |
Is there any solution for this ? trace=[]
layout = go.Layout( |
Yes. See #1701 (comment) |
@etpinard how can I implement your suggestion into my code ? it looks like it is a bit different |
Probably best to use https://community.plot.ly/ for questions of the likes. |
Now in #3735 |
Hi,
It would be nice to have an option to automatically set the legend label to the color of the corresponding marker.
For example, amCharts is using a parameter named 'useMarkerColorForLabels' in the config object.

Thanks in advance!
The text was updated successfully, but these errors were encountered: