You can either break this up into multiple cells and run the whole notebook
import time
from plotly import tools
import plotly.graph_objs as go
subplot = tools.make_subplots(2, 1)
f2 = go.FigureWidget(subplot)
i = 1
traceA = go.Scatter(
y = list(range(1,i*20)),
mode='lines')
f2.add_trace(traceA,row=i,col=1)
f2
time.sleep(5)
i = 2
traceA = go.Scatter(
y = list(range(1,i*20)),
mode='lines')
f2.add_trace(traceA,row=i,col=1)
Or you can use IPython.display.dispaly to display the figure in the middle of the cell
import time
from plotly import tools
import plotly.graph_objs as go
from IPython.display import display
subplot = tools.make_subplots(2, 1, print_grid=False)
f2 = go.FigureWidget(subplot)
display(f2)
time.sleep(2)
i = 1
traceA = go.Scatter(
y = list(range(1,i*20)),
mode='lines')
scatter = f2.add_trace(traceA,row=i,col=1)
time.sleep(2)
i = 2
traceA = go.Scatter(
y = list(range(1,i*20)),
mode='lines')
scatter1 = f2.add_trace(traceA,row=i,col=1)