Skip to content
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

Legend color turns black if specifying specific colors for each bar #1212

Closed
sijmenvos opened this issue Dec 1, 2016 · 8 comments · Fixed by #1289
Closed

Legend color turns black if specifying specific colors for each bar #1212

sijmenvos opened this issue Dec 1, 2016 · 8 comments · Fixed by #1289

Comments

@sijmenvos
Copy link

For a project I'm using lighter bar colors to display what bars have insufficient datapoints to draw conclusions from it. Unfortunately this results in the legend color being black.

Is there a workaround to fix this problem? If not it would be a nice feature to be able to set the color of the legend manually for each series.

Example:
https://plot.ly/~sijmen/3/

@etpinard
Copy link
Contributor

etpinard commented Dec 1, 2016

Looks like the legend item fallback is wrong for bar traces.

Thanks for pointing this out.

@etpinard
Copy link
Contributor

etpinard commented Dec 1, 2016

Reproducible codepen: http://codepen.io/etpinard/pen/JbMbXe

@sijmenvos sijmenvos changed the title Legend color turn black if specifying specific colors for each bar Legend color turns black if specifying specific colors for each bar Dec 1, 2016
@sijmenvos
Copy link
Author

Thanks for fixing this!

It seems that the color of the legend when you deselect a serie it is still black. Normally it's a fade out of the color of the serie.

See the codepen: http://codepen.io/etpinard/pen/JbMbXe
And click on a legend item to deselect it.

Regards,
Sijmen

@aanchalvazir
Copy link

Hi @etpinard

I am facing a similar issue. I am creating a bar chart in Dash plotly, to which I am assigning a color scale for showing diverging colors (not assigning colors per bar but a assigning a scale which can do this automatically as per a measure for reference). However, the legend for this chart appears black.

The following is a snippet of what I am trying to achieve:

'data':[
go.bar(
x='dates',
y=( df['mean'] - dff['mean'] ),
marker={'colorscale':'Greens', 'color':(dff['mean'])},
showlegend=True,
legendgroup='group2',
yaxis='y3',
)
],

'layout':[
'yaxis3':{
'domain':[0.8, 1],
'rangemode':'nonnegative',
'visible':False,
'mirror':True,
'range':[0,250000],
'scaleratio': 1,
}
]

I do not want to show the continuous color scale itself as shown in : https://plotly.com/python/colorscales/ but the legend itself.
Could you suggest a work around?

Thanks in advance!

@nitram9
Copy link

nitram9 commented Nov 16, 2020

It seems, this problem is occurring again in 2020.

@archmoj
Copy link
Contributor

archmoj commented Nov 16, 2020

It seems, this problem is occurring again in 2020.

@nitramwin could you please share a minimal codepen illustrating the bug you noticed?
Thanks!

@nitram9
Copy link

nitram9 commented Nov 16, 2020

@archmoj Thanks for the response. Here it is: https://codepen.io/nitramwin/pen/mdEoxZo

@archmoj
Copy link
Contributor

archmoj commented Nov 16, 2020

@archmoj Thanks for the response. Here it is: https://codepen.io/nitramwin/pen/mdEoxZo

Thanks @nitramwin. Tracked in #5285.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants