Hoping it is not a trivial question. Based on a few examples (notably at https://mybinder.org/v2/gh/jonmmease/plotly_ipywidget_notebooks/master, notably notebooks/Interact.ipynb), I tried to following in a Jupyter notebook:
import numpy import plotly.graph_objects import ipywidgets x = numpy.linspace(0,1,100) y = numpy.linspace(0,1,100) z = numpy.outer(x, y) figure = plotly.graph_objects.FigureWidget() surface = figure.add_surface(x=x, y=y, z=z) figure.show() @ipywidgets.interact(n=ipywidgets.widgets.IntSlider(min=1, max=10, step=1, value=1)) def update_figure(n): surface.data.z[:,:] = numpy.outer(x, y)**n figure.batch_update()
But unfortunately the figure is not updated. If I replace the last
figure.show() I get a second figure that gets updated, but that is not optimal. Is there a way to actually update the existing figure? Thank you so much for your help.