When showing several bokeh plots in the most recent version of Jupyter lab, and scrolling between them it happens almost always that the plots disappear completely, except for all or part of the tools bar.
Versions used:
- bokeh 3.7.3
- jupyterlab 4.4.4
- IPython 9.2.0
- jupyter_bokeh 4.0.5
- bokehJS is 3.73 as well
I wish I could upload a video here to show that behaviour but there is one here:
There are no errors on the JS console.
My feeling is that this is a problem with how bokeh plots get repainted when the page gets scrolled in a way to make them move into the visible area again: sometimes the appear after some delay, sometimes they do not appear at all.
I have no idea if this is bug in bokeh or jubyterlab or both but it is extremely annoying. This does not happen with plotly dynamic plots so I lean towards thinking it may be a bokeh bug.
Does anyone else experience this?
Here is the code for reproducing this:
import bokeh
print("bokeh", bokeh.__version__)
import bokeh.io
import bokeh.plotting
import numpy as np
import notebook, IPython, jupyter, jupyter_bokeh, jupyterlab
print("notebook", notebook.__version__, "IPython", IPython.__version__,
"jupyter_bokeh", jupyter_bokeh.__version__, "jupyterlab", jupyterlab.__version__)
bokeh.io.output_notebook()
x=np.arange(1000)
y1=np.random.randn(1000)
y2=np.random.randn(1000)
y3=np.random.randn(1000)
def make_plot():
source = bokeh.models.ColumnDataSource(data=dict(x=x,y1=y1,y2=y2,y3=y3))
xdr = bokeh.models.Range1d(start=0, end=99)
p1 = bokeh.plotting.figure(height=200, width=1000,tools="xpan,box_zoom,wheel_zoom,xbox_select,reset,undo", toolbar_location="above",x_axis_location="above", x_range=xdr)
p1.line('x', "y1", source=source)
p2 = bokeh.plotting.figure(height=200, width=1000,tools="", toolbar_location=None,x_axis_location="below", x_range=xdr)
p2.line('x', "y2", source=source)
p3 = bokeh.plotting.figure(height=200, width=1000,tools="", toolbar_location=None,x_axis_location="below", x_range=xdr)
p3.line('x', "y3", source=source)
fig=bokeh.layouts.gridplot([p1,p2,p3], ncols=1)
return fig
fig=make_plot()
bokeh.plotting.show(fig)
Then a bunch of empty lines to enable scrolling then once the first plot as scrolled of the page
bokeh.plotting.show(fig)
maybe repeat two or three times.
Then scroll up and down und you will notice that some plots complety disappear and never come back while others first are gone but get re-drawn after a few seconds.