I have the following code:
import numpy as np
import plotly.graph_objects as go
from ipywidgets import interact
EST = np.random.normal(size=(10,2))
fig = go.FigureWidget()
fig.add_scatter(mode='markers')
@interact(s=(0,len(EST)-1))
def update(s=0):
with fig.batch_update():
fig.data[0].x=[EST[s,0]]
fig.data[0].y=[EST[s,1]]
print(EST[s,0], ' ', EST[s,1])
fig.show()
I specify the x and y coordinate and want to make the point move to the new location.
I don’t understand why it doesn’t. What am I missing?