Subplots with FigureWidget

#1

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?

#2

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 (https://ipywidgets.readthedocs.io/en/stable/examples/Widget%20Custom.html) 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 https://medium.com/@plotlygraphs/introducing-plotly-py-3-0-0-7bb1333f69c6. And if you’d like to learn even more, you can check out my SciPy 2018 paper at http://conference.scipy.org/proceedings/scipy2018/jon_mease.html.

-Jon

1 Like