如何将数据列表发送到Bokeh vplot()

时间:2015-08-18 00:42:21

标签: python bokeh

我在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'

1 个答案:

答案 0 :(得分:3)

您需要明确地将列表作为grid = vplot(children=channelPlots) 参数传递:

vplot

或者,*args接受孩子为grid = vplot(*channelPlots)

Dim re
Set re = CreateObject("VBScript.RegExp")
re.Pattern = "\d"
re.Global = True

MsgBox "Digits: " & re.Execute("adf20j83n,m3jh2k9").Count