bokeh overlay multiple plot objects in a GridPlot

对着背影说爱祢 提交于 2019-11-30 23:15:40

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.

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)
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!