@Wait_What It doesn’t take 20 lines, lots of the lines in that example have to do with formatting and appearance. But it also does not take one line. Bokeh’s priority is being general purpose and flexible. This makes it somewhat more verbose, but also a great target for higher level, specialized and opinionated tools to build on.
from bokeh.models import ColumnDataSource
from bokeh.plotting import figure, show
from bokeh.transform import dodge
import pandas as pd
months = ['jan', 'feb', 'mar']
data = pd.DataFrame({
'month' : ['jan', 'jan', 'feb', 'feb', 'mar', 'mar'],
'name' : ['peter', 'kelly', 'peter', 'kelly', 'peter', 'kelly'],
'number' : [5, 3, 3, 2, 4, 6],
})
# three lines:
p = figure(x_range=months, toolbar_location=None, tools="")
p.vbar(x=dodge('month', 0.2, range=p.x_range), top='number', width=0.4,
source=data[data.name=='peter'], color="#c9d9d3")
p.vbar(x=dodge('month', -0.2, range=p.x_range), top='number', width=0.4,
source=data[data.name=='kelly'], color="#718dbf")
show(p)
This is not the only way to do this, and maybe not the best, since it duplicates data on the client. But it’s probably the shortest which seems to be your primary concern.