Bokeh - Nested Tabs

I am trying to create a set of tabs using the following approach…

The reason for this method is that I would then like to replace p1 with a figure created from a function and so can’t be hard coded.

At the moment the code does not produce the graphs or any errors.

Any suggestions would be appreciated.

from bokeh.models.widgets import Panel, Tabs
from bokeh.io import output_file, show
from bokeh.plotting import figure

p1 = figure(plot_width=300, plot_height=300)
p1.circle([1, 2, 3, 4, 5], [6, 7, 2, 4, 5], size=20, color=“navy”, alpha=0.5)

tab_parents = [“Fixed_Price_Tabs”,“Variable_Price_Tabs”]

notebooks = [“Fixed_Price”,“Variable_Price”]

tab_children = [“Low”, “Medium”, “High”, “Very High”]

for idx_1, tab_1 in enumerate(notebooks):
for idx_2, tab_2 in enumerate(tab_children):
tab_children[idx_2] = Panel(child=p1,title=“circle”) # replace p3 with funciton call
print(tab_children[idx_2])
Fixed_Price = Tabs(tabs=tab_children)
notebooks[idx_1] = Tabs(tabs=tab_children)
tab_parents[idx_1] =Panel(child=notebooks[idx_1],title=“Variable Price”)
Test = Tabs(tabs=tab_parents)
show(Test)

``

I think the issue was due to using the same figure to populate all the tabs, although I am not sure why this would be an issue. When I defined p1 as an array of figures and indexed each instance using idx_2 the tabs produced successfully.

···

On Tuesday, July 10, 2018 at 5:23:21 PM UTC+1, Rob Robinson wrote:

I am trying to create a set of tabs using the following approach…

The reason for this method is that I would then like to replace p1 with a figure created from a function and so can’t be hard coded.

At the moment the code does not produce the graphs or any errors.

Any suggestions would be appreciated.

from bokeh.models.widgets import Panel, Tabs
from bokeh.io import output_file, show
from bokeh.plotting import figure

p1 = figure(plot_width=300, plot_height=300)
p1.circle([1, 2, 3, 4, 5], [6, 7, 2, 4, 5], size=20, color=“navy”, alpha=0.5)

tab_parents = [“Fixed_Price_Tabs”,“Variable_Price_Tabs”]

notebooks = [“Fixed_Price”,“Variable_Price”]

tab_children = [“Low”, “Medium”, “High”, “Very High”]

for idx_1, tab_1 in enumerate(notebooks):
for idx_2, tab_2 in enumerate(tab_children):
tab_children[idx_2] = Panel(child=p1,title=“circle”) # replace p3 with funciton call
print(tab_children[idx_2])
Fixed_Price = Tabs(tabs=tab_children)
notebooks[idx_1] = Tabs(tabs=tab_children)
tab_parents[idx_1] =Panel(child=notebooks[idx_1],title=“Variable Price”)
Test = Tabs(tabs=tab_parents)
show(Test)

``