I’m trying to use the plotly backend to make some bar charts and I want to specify the colour of the bars. But when I do that I get the following error;
Option 'color' for Bars type not valid for selected backend ('plotly')
Silly one here, I’m not familiar with GitHub even though registered, I couldn’t see how to upvote is it an actual button or leaving a comment?
I was playing with the code yesterday after saw this, I can see the options for the plotly backend does not exist currently which I guess is why it does not work.
import pandas as pd
import holoviews as hv
hv.extension("bokeh")
data = pd.DataFrame({
"framework": ["hvPlot", "HoloViews", "Panel"],
"stars": [700, 2400, 2600]
})
plot = hv.Bars(data, kdims="framework", vdims="stars").opts(ylabel="⭐", width=1000) # no color provided with bokeh backend color defaults to color=Cycle()
import panel as pn
pn.extension()
pn.panel(plot).servable()
Now if change to plotly backend as others have tried you can see the color option doesn’t exist for user to pass something too and includes a friendly warning at least with the versions of imports I’m making use of.
I saw that code for changing color in plotly bar can accept single or list and also you can base it on column names of the dataframe but I think this is then auto colouring. I guess I was just looking here to see that plotly could indeed change the colour of the bars at user digression because some of it is very automagic.