Skip to content Skip to sidebar Skip to footer

Bokeh Overlay Multiple Plot Objects In A Gridplot

Say I have a class that holds some data and implements a function that returns a bokeh plot import bokeh.plotting as bk class Data(): def plot(self,**kwargs): # do some

Solution 1:

As of Bokeh 0.7 the plotting.py interface has been changed to be more explicit and hopefully this will make things like this simpler and more clear. The basic change is that figure now returns an object, so you can just directly act on those objects without having to wonder what the "currently active" plot is:

p1 = figure(...)
p1.line(...)
p1.circle(...)

p2 = figure(...)
p2.rect(...)

gp = gridplot([p1, p2])
show(gp)

Almost all the previous code should work for now, but hold, curplot etc. are deprecated (and issue deprecation warnings if you run python with deprecation warnings enabled) and will be removed in a future release.

Solution 2:

Ok apparently bk.curplot() does the trick

exps.scatter(arg1)
sets.plot(arg2)
p1 = bk.curplot()
bg.figure()     # reset figure
exps.scatter(arg3)
sets.plot(arg4)
p2 = bk.curplot()
gp = bk.GridPlot(children=[[p1,p2])
bk.show(gp)

Post a Comment for "Bokeh Overlay Multiple Plot Objects In A Gridplot"