Open johann-petrak opened 1 year ago
Thanks for filing the issue @johann-petrak, what you describe is not quite accurate. We do support bi-directional interactivity with the Plotly pane (indeed the long-time maintainer of the Plotly Python interface contributed the feature). Can you give me an example of what you expect to work and what doesn't work right now so we can either improve the documentation or make it easier to use?
Thank you - my initial misunderstanding was that I expected that Panel would be able to include/wrap an interactive Plotly figure via the FigureWidget wrapper similar to how Plotly itself and Voila make this work in Notebooks. I now understand that Panel instead apparently re-implemented this in the same way how other kinds of Panel interactivity works, which is a good idea.
However, it is still not clear to me how to achieve the same (or similar) as the callbacks in Figure widget give me.
For example, I would like to have a python function get called when the user does one of these things:
I tried, with a Jupyter Notebook e.g.
responsive = pn.pane.Plotly(myscatterplot, config={'responsive': True})
pn.Column(responsive, sizing_mode='stretch_width')
responsive.param.watch(print, ["viewport", "selected_data", "click_data"])
but nothing seems to get printed when I manipulate (zoom, select, click) the graph.
Maybe I am still not getting how to do this right - a few illustrative examples for how to make those callbacks work would certainly be helpful, especially for noobs like me.
Great, I would indeed expect that to work so I'll look into it and then we can work up some examples of those features.
Was there any opportunity for somebody being more knowledgeable about this than me to try it? As mentioned, there are two things which I would expect to work: python functions getting called when there is interaction with the plot like zooming, scrolling, clicking, hovering; and the ability to determine the current properties of the plot, e.g. which x-axis range is currently shown to the user (e.g. after zooming and panning ).
Panel is great for generating dashboards and GUIs from Notebooks or just plain python code and it is somewhat similar to Voila in that respect.
However, unlike Voila, there is apparently no direct support for displaying anything that can be displayed in a notebook via the display(..) function.
One such example is the plotly.plotly.graph_objects.FigureWidget - it would be extremely useful to display such objects in a panel, but there seems to be no way to do this currently.
Panel supports Plotly figures through an extension, however, this way of showing the figure reduces interactivity to javascript only functionality, while displaying through a FigureWidget allows for interaction to and from Python callbacks, which is very important.
Showing FigureWidget objects works just fine in Jupyter notebook, Jupyter lab and Voila,so I think it should be possible in Panel as well.