bokeh / jupyter_bokeh

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

The pan and zoom tools doesn't work well in widget mode #83

Closed ruoyu0088 closed 4 years ago

ruoyu0088 commented 4 years ago

Here is the code:

from bokeh.plotting import figure
from bokeh.models import ColumnDataSource
import jupyter_bokeh as jb
import numpy as np

fig = figure(height=200, width=300)
x = np.linspace(0, 10, 200)
y = np.sin(x)
source = ColumnDataSource(data=dict(x=x, y=y))
line = fig.line("x", "y", source=source)
fig_w = jb.BokehModel(fig)
fig_w

and the response of the pan and zoom operations.

fig_widget

Here is the version info:

Windows 10, Chrome and Firefox

bokeh: 1.4.0
jupyter lab: 1.2.1
notebook: 6.0.1
jupyter_bokeh: 1.1.0
python: 3.7.3

the widget mode means communicate between bokehjs and python kernel through ipywidgets.

Here is the example notebook:

https://github.com/bokeh/jupyter_bokeh/blob/master/examples/jupyter_widgets.ipynb

bryevdv commented 4 years ago

@ruoyu0088 We will need a lot more information:

Additionally, I don't really know what you mean by "widget mode" so that will require some explanation or references

bryevdv commented 4 years ago

cc @mattpap

I guess this is new?

fig_w = jb.BokehModel(fig)

Is this documented somewhere?

philippjfr commented 4 years ago

I can reproduce this using bokeh 1.4.0 and the jupyter_bokeh 1.1.0 in all browsers and both in JLab and classic notebook. I suspect the problem here is that the messages do not include the setter so events end up bouncing back and forth. I'll try to figure out a fix here.

bryevdv commented 4 years ago

I suspect the problem here is that the messages do not include the setter so events end up bouncing back and forth.

That would certainly cause problems. It would be good to add some information about this to the User's Guide as well.