使用python Bokeh分组条形图更改条形宽度?

gwa*_*n13 2 python pandas bokeh

这是一个例子.无论我怎么能bar_width,这个数字看起来完全一样.如何增加所有条形的宽度?

from bokeh.charts import Bar, output_notebook, show, vplot, hplot, defaults
from bokeh.sampledata.autompg import autompg as df
output_notebook()

df['neg_mpg'] = 0 - df['mpg']

defaults.width = 550
defaults.height = 400
bar_plot7 = Bar(df, label='cyl', values='displ', agg='mean', group='origin', bar_width=10,
                title="label='cyl' values='displ' agg='mean' group='origin'", legend='top_right')
show(bar_plot7)
Run Code Online (Sandbox Code Playgroud)

Ran*_*ndy 6

看起来像Bokeh的新版本中的一个错误,其宽度并没有一直到最后.现在,您可以执行以下操作:

for r in bar_plot7.renderers:
    try:
        r.glyph.width = 0.1
    except AttributeError:
        pass
Run Code Online (Sandbox Code Playgroud)

show()打电话之前做出瘦骨条.