The following code creates a new tab with a plot in the browser for each iteration in the loop. How can I update the existing plot so that I always see new data points in the same plot?
import plotly.io as pio
pio.renderers.default = "browser"
import time
import plotly.graph_objects as go
data = [1,3,2,4,3,3,2,3]
fig = go.FigureWidget()
fig.add_scatter()
for i in range(len(data)):
time.sleep(0.5)
fig.data[0].y = data[:i]
fig.show()