Closed
Description
Current Behavior (plotly version 4.14.3)
When using the text
property in a bar trace with a continuous color scale, the textfont.color
is static; all bars use the same text color, which results in difficult to read text for some bars (far right bar in screenshot).
import plotly.express as px
x = list(range(1, 10))
px.bar(x=x, y=x, color=x, text=[str(i) for i in x])
Expected/Desired Behavior
The text font color should be dynamic (dark text on light colored bars, light text on dark bars), just like the hover text. Bar traces with discrete colorscales already have this behavior:
import plotly.express as px
x = list(range(1, 10))
px.bar(x=x, y=x, color=[str(i) for i in x], text=[str(i) for i in x], color_discrete_sequence=px.colors.sequential.Plasma)
Metadata
Metadata
Assignees
Labels
No labels