Reputation: 41
I'm able to generate/show individual plots, but cannot seem to be able to aggregate multiple plots into a single gridplot. What am I doing wrong, thanks?
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
The exact error message I get is..
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
Upvotes: 0
Views: 952