Reputation: 1453
I'm checking the Bokeh tutorials, and I'm not able to change the palette in a Bar plot. In particular, I'm trying to complete the last exercise in this notebook with the following code:
from bokeh.palettes import brewer
from bokeh.palettes import Blues5,YlGnBu9, YlOrBr9, YlOrRd9
bar = Bar(medals,label="name",values="count",stack="medal",agg="sum",color="medal",palette=Blues5)
show(bar)
Whatever palette I try from the second line, the result is the same. Am I missing something? I'm using Bokeh 0.10.
Cheers.
Upvotes: 1
Views: 1308
Reputation: 1
This is the method I find works, it will color each bar of the chart according to the 'Cost' of the object.
from bokeh.models import ColorBar, LinearColorMapper
from bokeh.palettes import Viridis256
mapper = LinearColorMapper(palette=Viridis256, low=0, high=150)
color_bar = ColorBar(color_mapper=mapper, location=(0,0))
plot = df.plot_bokeh.bar(
x='Date',
y='Cost',
title='Expenses'
color= {'field': 'Cost', 'transform': mapper})
show(plot)
You can see the result here: [1]: https://i.sstatic.net/6oVLr.png
Upvotes: 0
Reputation: 305
This is how I've used this:
color = color(columns = 'Week of', palette = palettes.Set1_9)
Here I am saying what palette to use while saying what column to color by
Upvotes: 1