bokeh / jupyter_bokeh

An extension for rendering Bokeh content in JupyterLab notebooks
BSD 3-Clause "New" or "Revised" License
249 stars 48 forks source link

Displaying same figure with show and BokehModel #161

Open axil opened 2 years ago

axil commented 2 years ago

The following sequence of commands leads to a strangely looking error message:

from bokeh.io import output_notebook
from bokeh.resources import Resources, INLINE
from jupyter_bokeh import BokehModel
from bokeh.plotting import figure, output_file, show
output_notebook()

p = figure(plot_height=100)
p.scatter([1,2,3], [4,5,7])
show(p)
<displays p>

BokehModel(p)
<displays p>

p1 = figure(plot_height=100)
p1.scatter([1,2,3], [4,5,7])
<displays p1 then breaks the plot in the previous cell>

image

I understand that the real reason for this behavior is displaying the same figure with both show and BokehModel, but I would expect the error message to be in cell [4], not in cell [5].

Originally I thought it is because of my patch fixing the copy-pasting in jupyter, but no, it is just the same in the original bokeh==2.4.3 + jupyter_bokeh==3.0.4.