如何将图形列表发送到 Bokeh vplot()

How to send list of figures into Bokeh vplot()

我正在 Python 列表中以编程方式构建一个绘图列表,我想将它放在 vplot 函数而不是 grid 函数中目前正在使用。该文档明确列举了子项,但我想知道我是否可以获取图形对象列表并将它们以某种方式接收到 vplot 中,就像对网格对象所做的一样。

channelPlots = []

for channel in myChannels :
    channelPlot = figure( width=1000, height=1000 , title=channel+ " Time Series" , x_axis_label = channel , y_axis_label = "TIME" )
    y           = sample.data['TIME' ]
    x           = sample.data[channel]
    channelPlot.scatter(x,y)
    channelPlots.append(channelPlot)

# With a grid it works  
#grid = GridPlot(children=[channelPlots], title="Time Series Channel Plots")

# with a vplot it breaks
grid = vplot( channelPlots )
save(grid)


Exception error is: expected an element of List(Instance(Widget)), got [[<bokeh.plotting.Figure object at 0x0000000009AA2128>, <bokeh.plotting.Figure object at 0x0000000006778CF8>, <bokeh.plotting.Figure object at 0
x0000000011894C50>, <bokeh.plotting.Figure object at 0x00000000118DE390>, <bokeh.plotting.Figure object at 0x00000000118DEF98>, <bokeh.plotting.Figure object at 0x00000000118F2668>, <bokeh.plotting.Figure object at
0x00000000118EE7B8>, <bokeh.plotting.Figure object at 0x00000000118EE630>]]

尝试下面这两个都抛出了同样的异常...

grid = vplot(children=channelPlots)
grid = vplot(children=[channelPlots])
Exception error is: Viewable object got multiple values for keyword argument 'children'

您需要将列表作为 children 参数显式传递:

grid = vplot(children=channelPlots)

或者,vplot 接受 children 作为 *args:

grid = vplot(*channelPlots)