I would like to update the y-data in my 2 D plot without having to call 'plot' everytime
from matplotlib.figure import Figure
fig = Figure(figsize=(12,8), dpi=100)
for num in range(500):
if num == 0:
fig1 = fig.add_subplot(111)
fig1.plot(x_data, y_data)
fig1.set_title("Some Plot")
fig1.set_ylabel("Amplitude")
fig1.set_xlabel("Time")
else:
#fig1 clear y data
#Put here something like fig1.set_ydata(new_y_data), except that fig1 doesnt have set_ydata attribute`
I could clear and plot 500 times, but it would slow down the loop. Any other alternative?