使用matplotlib.figure情節數據我想更新我的2 d情節Y型數據,而不必調用「陰謀」每次更新在python
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`
我可以明確和圖500倍,但會減慢循環。任何其他的選擇?
另請參閱http://stackoverflow.com/questions/12822762/pylab-ion-in-python-2-matplotlib-1-1-1-and-updating-of-the-plot-while-the- pro/12826273#12826273 – tacaswell 2014-11-06 14:28:07
並且它是重複的 – tacaswell 2014-11-06 14:28:57