Subplots with FigureWidget

Is it possible to create subplots with FigureWidget() or is it only possible with tools.make_subplots()? In my experience FigureWidget() is faster and in JupyterLab the image is displayed scaled instantly to the width of the notebook.

A more general question: What is FigureWidget()? Is it aimed to replace the traditional way (with traces, data and iplot…) or was it mainly created to facilitate new interactivity features?

1 Like

Hi @ursus,

You can create a FigureWidget with subplots using tools.make_subplots by passing the Figure produced by make_subplots to the FigureWidget constructor. For example.

...
fig = go.FigureWidget(make_subplots(...))

A more general question: What is FigureWidget() ? Is it aimed to replace the traditional way (with traces, data and iplot…) or was it mainly created to facilitate new interactivity features?

FigureWidget is a custom ipywidget (Building a Custom Widget - Email widget — Jupyter Widgets 8.1.1 documentation) designed to take advantage of the jupyter widgets protocol to synchronize the displayed figure properties between the JavaScript display and the Python object. It doesn’t replace Figure, but I’d think of it as a specialized version of Figure that’s optimized for use in the Jupyter notebook / JupyterLab. For more background, see the 3.0 announcement post at 🌟 Introducing plotly.py 3.0.0 🌟 | by Plotly | Plotly | Medium. And if you’d like to learn even more, you can check out my SciPy 2018 paper at PROC. OF THE 17th PYTHON IN SCIENCE CONF. (SCIPY 2018).

-Jon

1 Like

@jmmease can FigureWidget() be used outside of Jupyter environments?
I’ve tried it in VS-Code but it does not show anything, so I’m wondering if that’s possible.