300字范文,内容丰富有趣,生活中的好帮手!
300字范文 > python画图中grid等于true_python – 散布在GridPlot中覆盖多个绘图对象

python画图中grid等于true_python – 散布在GridPlot中覆盖多个绘图对象

时间:2020-07-28 11:19:43

相关推荐

python画图中grid等于true_python – 散布在GridPlot中覆盖多个绘图对象

假设我有一个包含一些数据的类,并实现了一个返回散景图的函数

import bokeh.plotting as bk

class Data():

def plot(self,**kwargs):

# do something to retrieve data

return bk.line(**kwargs)

现在,我可以实例化多个这些Data对象,如exps和sets,并创建单独的图.如果设置了bk.hold(),它们将以一个数字结尾(这基本上就是我想要的).

bk.output_notebook()

bk.figure()

bk.hold()

exps.scatter(arg1)

sets.plot(arg2)

bk.show()

现在我希望将这些图聚合成一个GridPlot()我可以为非叠加的单个图进行聚合

bk.figure()

bk.hold(False)

g=bk.GridPlot(children=[[sets.plot(arg3),sets.plot(arg4)]])

bk.show(g)

但我不知道如何覆盖我之前作为exps.scatter的散点图.

有没有办法获得对当前活动数字的引用,如:

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)

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。