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

Mismatch between legend and line colors when using uppercase css colors #6883

Closed
Coding-with-Adam opened this issue Feb 2, 2024 · 1 comment
Labels
bug something broken sev-1 blocker

Comments

@Coding-with-Adam
Copy link
Contributor

Bug originally reported on the forum.
When using css colors with the first letter capitalized, a line chart will show all lines as black, although the legend will adhere to the correct css colors.

Codepen JS code

image

Plotly.py code:

import plotly.express as px

css_colors = ['AntiqueWhite', 'Aqua', 'Aquamarine', 'Black', 'Red']
# css_colors = [color.lower() for color in css_colors]

df = px.data.gapminder()
print(df['continent'].unique())
color_discrete_map = {subject: css_colors[i] for i, subject in enumerate(sorted(df['continent'].unique()))}
fig = px.line(df, x="year", y="lifeExp", color='continent', color_discrete_map=color_discrete_map)
fig.show()
@Coding-with-Adam Coding-with-Adam added bug something broken sev-1 blocker labels Feb 2, 2024
@Coding-with-Adam Coding-with-Adam changed the title css colors create mismatch between legen and line colors Mismatch between legend and line colors when using css colors Feb 2, 2024
@Coding-with-Adam Coding-with-Adam changed the title Mismatch between legend and line colors when using css colors Mismatch between legend and line colors when using uppercase css colors Feb 2, 2024
@depperm
Copy link

depperm commented Feb 4, 2024

already an issue: #6685

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something broken sev-1 blocker
Projects
None yet
Development

No branches or pull requests

3 participants