☰Read-only archive⌕
Looking for help with Bokeh?

This is a read-only archive. Ask questions and join the conversation on GitHub.

Visit Community Support on GitHub →
Archived discussions · Captured October 28, 2026

how to plot plot multiple columns of a dataframe as bars with charts.Bar?

Community Support
Laszlo_Molnar
Laszlo_Molnar

Hello,

I can not get my head around how to plot multiple columns as bars, for instance using the autompg example data which looks like this:

mpg cyl displ hp weight accel yr origin name
0 18 8 307 130 3504 12.0 70 1 chevrolet chevelle malibu
1 15 8 350 165 3693 11.5 70 1 buick skylark 320
2 18 8 318 150 3436 11.0 70 1 plymouth satellite

How to plot bars of cyl, mpg and accel for each car name (the groups would be cyl, mpg and accel with each car name inside these groups) on a single bar chart?

Code:

from bokeh.charts import Bar, output_file, show
from bokeh.sampledata.autompg import autompg as df

print(df.head())
df=df.iloc[:10, :]

how to modify this:

p = Bar(df, label=‘name’, values=[‘cyl’, ‘mpg’, ‘accel’], title=‘mpg cyl accel for each car name’)
output_file(“bar.html”)
show(p)

``

Thanks for any help in advance!
I am using bokeh 10.0.

⌁   Link to post

End of archived discussion · Replies are disabled