Bokeh overlays multiple plot objects in GridPlot

Say I have a class that contains some data and implements a function that returns a bokeh graph

import bokeh.plotting as bk
class Data():
    def plot(self,**kwargs):
        # do something to retrieve data
        return bk.line(**kwargs)

Now I can create several Data objects, such as expsand sets, and create separate graphs. If bk.hold()set, they will end up on the same figure (which is basically what I want).

bk.output_notebook()
bk.figure()
bk.hold()
exps.scatter(arg1)
sets.plot(arg2)
bk.show()

enter image description here

Now I want to aggregate these graphs in GridPlot(), I can do this for non superimposed single graphs

bk.figure()
bk.hold(False)
g=bk.GridPlot(children=[[sets.plot(arg3),sets.plot(arg4)]])
bk.show(g)

enter image description here

but I don’t know how I can superimpose the scatter plots that I had before, like exps.scatter.

Is there a way to get a link to the current active digit, for example:

rows=[]
exps.scatter(arg1)
sets.plot(arg2)
af = bk.get_reference_to_figure()
rows.append(af) # append the active figure to rows list
bg.figure()     # reset figure

gp = bk.GridPlot(children=[rows])
bk.show(gp)
+4
source share
2

Bokeh 0.7, plotting.py , , , , . , figure , , , "" :

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

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

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

, hold, curplot .. ( , python ) .

+5

, , bk.curplot()

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)
+2

All Articles