how do we apply a colorscale to a bar chart? I’ve tried witht he ‘colorway’ and ‘colorscale’ parameters but no matter what i do it still applies the default colors?
I’d like to use ‘viridis’ on a bar chart to achieve something like this:
This chart has one trace, and does not show a legend. If you want to show the legend, you can make each bar a different trace, by passing a list of go.Bars.
(I might be doing something wrong, but the scolorscale here is not taking Viridis and using the default scale.)
import plotly.graph_objs as go
fig2 = go.FigureWidget(data=[go.Bar(x=[x],
y=[y],
name=x,
marker={'color': y,
'colorscale': 'Viridis'})
for x, y in zip(x, y)])
fig2
Is there any answer to this?
In my case, it messes everything up and the legend shows just black color, which indicates that the legend elements are not connected to the colors used in the plot.