Plotly marker_color option doesn't work

What I’m trying to do:
make plotly bar chart with different colors

What I’ve tried and what’s not working:
use the following code. The chart uses the default color, setting of marker_color doesn’t work.

Code Sample:

colors = ['lightslategray',] * 5
colors[1] = 'crimson'

fig = go.Figure(data=[go.Bar(
    x=['Feature A', 'Feature B', 'Feature C',
       'Feature D', 'Feature E'],
    y=[20, 14, 23, 25, 22],
    marker_color=colors # marker color can be a single color value or an iterable
)])

Clone link:
share a copy of your app

I figured that out, change marker_color to marker={‘color’:colors} to make it work.

1 Like