Arnold Souza
Arnold Souza

Reputation: 671

Bokeh: add a grid of information below a plot

I have the plot below that I'm currently working on. It describes the movement of a certain product inside a warehouse.

movements chart

With this plot I also have a dictionary with lots of information about the product (unit cost, lead time, stock level and so on). I wonder if there is a way to also plot this information like a grid below the chart. The desired output would be something like:

desired output

I've searched for something like this, but the only thing more or less related that I've found was the possibility for bokeh to plot a table as a widget. But the output is something totally different:

table widget sample

If someone has an answer using or not the bokeh library, I appreciate the help :)

My actual code is:

p = figure(plot_width=640, plot_height=360, x_axis_type="datetime")
source = ColumnDataSource(df)

p.vbar(x='DT', top='STOCK', width=pd.Timedelta(days=1), source=source, fill_alpha=0.4, color='paleturquoise')
p.vbar(x='DT', top='SOMA_ENTRA', width=pd.Timedelta(days=1), source=source, fill_alpha=0.8, color='seagreen')
p.vbar(x='DT', top='SOMA_SAI', width=pd.Timedelta(days=1), source=source, fill_alpha=0.8, color='crimson')

hline = Span(location=0, line_alpha=0.4, dimension='width', line_color='gray', line_width=3)
p.renderers.extend([hline])

show(p)

Upvotes: 0

Views: 741

Answers (1)

Moritz
Moritz

Reputation: 339

Two possible solutions that I am using for similiar tasks:

  1. Add a Div widget to your bokeh layout and insert the appropriate HTML Code for your table there. (You can create HTML code for a table for example with pandas style method.)
  2. Customize the bokeh template and pass template variables for your addtional/customized content. (Jinja2 variables in bokeh)

Upvotes: 3

Related Questions