MHankin
MHankin

Reputation: 176

Plot multiple series in Bokeh with LinkedBrush gridplot

I'm trying to plot multiple series from a dataframe on the same plots in a bokeh figure with LinkedBrush. This probably doesn't make a ton of sense so let me provide an example based on the tutorial here.

Optimally i would like to make the following tweak on the inputs and colors (focus on the second plot):

gridplot([[
circle("yr", "mpg", color="blue", title="MPG by Year", source=source, **plot_config),
circle("hp", ["displ","mpg"], color=["green","red"], title="HP vs. Displacement", source=source, **plot_config),
circle("mpg", "displ", size="cyl", line_color="red", title="MPG vs. Displacement",
             fill_color=None, source=source, **plot_config) ]])

Part of the issue here is the fact that I can't used hold if I'm dropping these plots into a gridplot. I also imagine that "hold" would cause problems with the linked brushing aspect of gridplot. Does anyone know how to do this in bokeh?

Upvotes: 2

Views: 1433

Answers (1)

MHankin
MHankin

Reputation: 176

Just answered by greole here: "bokeh overlay multiple plot objects in a gridplot"

In my case, the following code modifications were needed:

circle("yr", "mpg", color="blue", title="MPG by Year", source=source, **plot_config)
p1 = curplot()
figure()
hold(True)
circle("hp", "displ", color="green", title="over", source=source, **plot_config)
circle("hp", "mpg", color="red", source=source, **plot_config),
hold(False)
p2 = curplot()
figure()
circle("mpg", "displ", size="cyl", line_color="red", title="MPG vs. Displacement",
         fill_color=None, source=source, **plot_config)
p3 = curplot()
gp=GridPlot(children=[[p1,p2,p3]])
show(gp)

Upvotes: 2

Related Questions