Within a larger program, I am trying to replacing an entire figure within curdoc(). Yes, this is a workaround for the more sensical method of changing specific datasources. For now, I ask that we put that issue aside. Also, apologies that i don’t have a larger program to demonstrate the issue. If it’s necessary to resolve the issue, I can put the time in.
Here is the function demonstrating my current approach. Within changeTrial(), make_trial_figure() generates an entirely new bokeh Figure that I would like to replace the current figure. The resulting browser behavior is that the new document appears below the old document. I would like to remove the old document from the session.
Thanks!
def changeTrial():
global fig, sourceList, trialSourceDict, session
trialSourceDict = init_trial_datasources()
force_update_sources()
fig = make_trial_figure()
# Add figure and widgets to a layout
<details class='elided'>
<summary title='Show trimmed content'>···</summary>
###########################################################################
from bokeh.layouts import layout
layout = layout([[fig], [widgetBox]], sizing_mode='fixed')
###########################################################################
# Add layout to current document
from bokeh.io import curdoc, set_curdoc
curdoc().clear()
curdoc().add_root(layout)