Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
GitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
Trouble Swapping out layout contents when using server #4810
I'm looking for a simple way to swap out figures inside a layout...basically hiding one figure and displaying another. Below I have an example of my intent. What Im seeing is that when a figure is dynamically added to a Column, its plot_height/plot_width is set to 0.
from bokeh.io import curdoc from bokeh.plotting import Figure from bokeh.models import Row, Column, Button from random import randint def _create_fig(): fig = Figure(plot_width=100, plot_height=100) fig.circle(x=0, y=0) return fig def callback(): num = randint(0,9) if num > 5: fig1_col.children = [_create_fig()] fig2_col.children =  else: fig2_col.children = [_create_fig()] fig1_col.children =  fig1 = _create_fig() fig2 = _create_fig() button = Button() button.on_click(callback) button_row = Row(children=[button]) fig1_col = Column(children=[fig1]) fig2_col = Column(children=[fig2]) fig_row = Row(children=[fig1_col, fig2_col]) layout = Column(children=[button_row, fig_row]) curdoc().add_root(layout)
Just confirming that this is not fixed by any work up to 0.12.6dev7
Also here is updated code:
It sort of works sometimes, but toolbars aren't showing up. ALso lots of log messages like:
Guessing there is a problem synching models that have references to other new models and/or removing entire models.