[英]bokeh multiple plots into a gridplot
我能夠生成/顯示單個圖,但似乎無法將多個圖聚合到一個網格圖中。 我做錯了什么,謝謝?
g = []
for item in basket:
# sourcing and processing my data streams here
# then moving to plotting the processed data into a single plot as below
TOOLTIPS = [("(x,y)", "($x, $y)")]
p = figure(tools="pan,box_zoom,reset,save",
title=TITLE,x_range=x,
y_range=(<<my_y0_range_1>>,<<my_y0_range_2>>),
x_axis_label='time',y_axis_label='index',
plot_width=1000, plot_height=450,toolbar_location="below",
tooltips=TOOLTIPS)
p.background_fill_color = <<mycolor>>
p.line(x, y0, legend_label="values", line_width=1)
p.extra_y_ranges = {"Vol": Range1d(start=<<my_y1_range_1>>,end=<<my_y1_range_2>>)}
p.line(x, y1, legend_label="my 2nd Y axis", line_color="red",y_range_name="Vol")
p.varea(x=x,y1=<<my_range_1>>,y2=<<my_range_2>>,alpha=0.3)
p.add_layout(LinearAxis(y_range_name="Vol"), 'right')
#show(p) <-- this works and displays the individual plot
g.append(p)
# end/exit my for loop here
print (len(g)) <-- this prints out 3 in my test case
print (g) <-- [Figure(id='1001', ...), Figure(id='1066', ...), Figure(id='1131', ...)]
grid = gridplot(g) <-- complains here
我得到的確切錯誤信息是..
grid = gridplot(g)
File "\Python\Python35\lib\site-packages\bokeh\layouts.py", line 304, in gridplot
for x, item in enumerate(row):
TypeError: 'Figure' object is not iterable
gridplot
采用列表列表(行列表),而不是單個 1d 列表。 (或者如果你真的想要,它確實需要一個 1d 列表,但你必須在調用中指定ncols
。)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.