我知道在Bokeh中将绘图分组在一起的2种不同方式:网格和HBox / VBox。我想有一种创建nxm网格的通用方法,其中网格的某些单元格可以为空。例如,如果每个X是一个绘图,则可能需要:
X X X
X
X X X
我还没有找到执行此操作的一般方法。假设我用以下方法创建了图:
import numpy as np
import bokeh.plotting as bp
from bokeh.models import GridPlot
bp.output_file("/tmp/test.html", "test")
def random_plot (width, height, k=100):
x = np.arange(k)
y = np.random.normal(size=k)
plot = bp.figure (
plot_width=width, plot_height=height, title=None,
toolbar_location=None)
plot.line(x,y)
return plot
UL = random_plot(width=300, height=400)
UR = random_plot(width=600, height=400)
LL = random_plot(width=300, height=200)
LR = random_plot(width=600, height=200)
我不能使用GridPlot(据我所知)仅用以下方法创建图:
UL UR
LR
以下内容不起作用:
grid = GridPlot(children=[[UL, UR], [None, LR]])
bp.show (grid)
我可以使用HBox和VBox的组合来实现上面的简单布局:
left = bp.VBox(children=[UL])
right = bp.VBox(children=[UR,LR])
combined = bp.HBox (children=[left,right])
bp.show(combined)
但是,不能处理更复杂的情况,例如上面显示的3 x 3配置。
我希望数字一致。我可以将不可见元素放入网格中以满足丢失的单元格吗?如果是这样,怎么办?
更新
发生时,有人在Bokeh邮件列表上请求了此消息(并且当前似乎不支持此消息)。希望不久将成为GridPlot的新功能。
散景0.7.1(将于下周一发布)将适用None
于底锅规格。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句