Náthali
Náthali

Reputation: 937

Bokeh Python: Laying out multiple plots

I want to array plots horizontally, use the hplot() function. My problem is that I generate my plot names dinamically. Dfdict is a dictionary of dataframes

for key in dfdict.keys():
    plot[key] = BoxPlot(dfdict[key], values='oex', ...)
    filename = '{}.html'.format(str(key))
    output_file(filename)
    show(plot[key])
p = hplot(plot.values())
show(p)

But i have an error:

ValueError: expected an element of List(Instance(Component)), got seq with invalid items [[, , , , , ]]

Thanks

Upvotes: 0

Views: 547

Answers (2)

bigreddot
bigreddot

Reputation: 34568

Please note that hplot is deprecated in recent releases. You should use bokeh.layout.row:

from bokeh.layouts import row

# define some plots p1, p2, p3

layout = row(p1, p2, p3)

show(layout)

Functions like row (and previously hplot) take all the things to put in the row as individual arguments.

There is an entire section on layouts in the user's guide:

http://docs.bokeh.org/en/latest/docs/user_guide/layout.html

Upvotes: 2

Náthali
Náthali

Reputation: 937

I do it, intead of this

p = hplot(plot.values())

I am using this

p = hplot(*plot.values())

Upvotes: 0

Related Questions