Hi all,
I’m using plot.ly offline in the notebook. I’m plotting a char (see screenshot) and using a loop, I plot one by one the red dot on top of it. Using the following code, I get a new plot added to the bottom of the previous plot for each loop.
list_times_done = []
list_temperature_done = []
fig = go.Figure()
trace = go.Scatter(
x = list_times,
y = list_temperature,
mode = 'lines+markers',
name="Rebinned Files",
hoverinfo='name',
line = dict(
shape = 'hvh'),
)
trace1 = go.Scatter(
x = [],
y = [],
mode = 'markers',
marker = dict(
size = 20,
color = 'rgba(255,0,0,0.5)'
)
)
layout = go.Layout(
title = 'Progress of Rebinned File Created',
xaxis = dict(
title = 'Time (span)'
),
yaxis = dict(
title = 'Temperature (C)'
),
)
fig.data = [trace, trace1]
fig.layout = layout
iplot(fig)
for index, _files in enumerate(list_files_to_merge):
_new_time = list_times[index]
_new_T = list_temperature[index]
trace1.x.append(_new_time)
trace1.y.append(_new_T)
iplot(fig)
Is there a way to clear the previous plot displayed?
thanks
Jean