Plots in tabs

Hi,

Firstly thanks for fixing the DataTable so it’s editable in 0.12.3, having that working is very useful for me.

I can’t seem to get plots working properly in tabs. I’ve got an application which has two main tabs, one for controls and one for plots, and multiple tabs within the plots tab for individual plots. There’s a minimal functional example below - when the ‘Do Plots’ button on the ‘Control’ tab is pressed, only the last of the plots appears correctly. The other two don’t work, though something (can’t make it out) appears in the top left hand corner in each case.

Any help gratefully received. Code as follows:

from bokeh.io import curdoc
from bokeh.plotting import Figure
from bokeh.models.widgets import Tabs, Panel, Button
from bokeh.models.layouts import Column
import numpy

class TabsTest():

def __init__(self):
   
    self.numPlots = 3
   
    self.Control = Button(label = 'Do Plots')
    self.Control.on_click(self.DoPlots)
   
    tabs = []
    for p in range(self.numPlots):
        tabs.append(Panel(title = 'Power = ' + str(p),
                          child = Column(Figure(toolbar_location = None))))
    self.Plots = Tabs(tabs = tabs)
   
    self.GUI = Tabs(tabs = [Panel(child = self.Control,title='Control'),
                            Panel(child = self.Plots,title='Plots')])

def DoPlots(self):

    x = numpy.linspace(1,5,5)
    for p in range(self.numPlots):
        y = x**p
        disp = Figure()
        disp.circle(x,y,size=10)
        self.Plots.tabs[p].child.children[0] = disp

curdoc().add_root(TabsTest().GUI)
curdoc().title = ‘Tabs Test’

Sorry to be pushy but I’m stuck - has anyone got any ideas on this? It seems simple enough but I’ve tried a few variations and still can’t get it to work. Is it that nesting tabs beyond a single level won’t work for plots, or something like that?

Thanks,
Marcus.

···

On Monday, October 31, 2016 at 5:54:35 PM UTC, Marcus Donnelly wrote:

Hi,

Firstly thanks for fixing the DataTable so it’s editable in 0.12.3, having that working is very useful for me.

I can’t seem to get plots working properly in tabs. I’ve got an application which has two main tabs, one for controls and one for plots, and multiple tabs within the plots tab for individual plots. There’s a minimal functional example below - when the ‘Do Plots’ button on the ‘Control’ tab is pressed, only the last of the plots appears correctly. The other two don’t work, though something (can’t make it out) appears in the top left hand corner in each case.

Any help gratefully received. Code as follows:

from bokeh.io import curdoc
from bokeh.plotting import Figure
from bokeh.models.widgets import Tabs, Panel, Button
from bokeh.models.layouts import Column
import numpy

class TabsTest():

def __init__(self):
   
    self.numPlots = 3
   
    self.Control = Button(label = 'Do Plots')
    self.Control.on_click(self.DoPlots)
   
    tabs = []
    for p in range(self.numPlots):
        tabs.append(Panel(title = 'Power = ' + str(p),
                          child = Column(Figure(toolbar_location = None))))
    self.Plots = Tabs(tabs = tabs)
   
    self.GUI = Tabs(tabs = [Panel(child = self.Control,title='Control'),
                            Panel(child = self.Plots,title='Plots')])

def DoPlots(self):

    x = numpy.linspace(1,5,5)
    for p in range(self.numPlots):
        y = x**p
        disp = Figure()
        disp.circle(x,y,size=10)
        self.Plots.tabs[p].child.children[0] = disp

curdoc().add_root(TabsTest().GUI)
curdoc().title = ‘Tabs Test’