Python 在bokeh中更改条形图中的调色板

Python 在bokeh中更改条形图中的调色板,python,plot,bokeh,Python,Plot,Bokeh,我正在查看Bokeh教程,无法更改条形图中的调色板。特别是,我正在努力完成中的最后一个练习 使用以下代码: from bokeh.palettes import brewer from bokeh.palettes import Blues5,YlGnBu9, YlOrBr9, YlOrRd9 bar = Bar(medals,label="name",valu

我正在查看Bokeh教程,无法更改条形图中的调色板。特别是,我正在努力完成中的最后一个练习 使用以下代码:

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)
无论我从第二行尝试什么调色板,结果都是一样的。我错过什么了吗?我用的是Bokeh0.10


干杯。

我就是这么用的:

 color = color(columns = 'Week of', palette = palettes.Set1_9)

这里我说的是要用什么调色板,同时说要用什么列上色这是我发现有效的方法,它会根据对象的“成本”给图表的每个栏上色

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)
您可以在此处看到结果: [1] :