1
我試圖讓基於這個例子中的動畫。我的主要問題是我不知道如何將動畫連接到錯誤欄。也許有人已經解決了類似的 東西..動畫使用matplotlib + errorbar
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
line, = ax.plot(x, np.sin(x))
def animate(i):
ax.errorbar(x, np.array(x), yerr=1, color='green')
line.set_ydata(np.sin(x+i/10.0)) # update the data
return line,
#Init only required for blitting to give a clean slate.
def init():
ax.errorbar(x, np.array(x), yerr=1, color='green')
line.set_ydata(np.ma.array(x, mask=True))
return line,
ani = animation.FuncAnimation(fig, animate, np.arange(1, 200), init_func=init,
interval=25, blit=True)
plt.show()
我會建議你通過閱讀這篇[教程](http://jakevdp.github.io/blog/2012/08/18/matplotlib-animation-tutorial/)開始,然後回來與_specific_問題。 – tacaswell 2013-04-08 20:22:05
和[這些實施例](http://matplotlib.org/examples/animation/index.html) – tacaswell 2013-04-08 20:24:31
@tcaswell我需要像這樣的代碼的結果,但例如它必須移動到右邊(它 - 我的意思是X軸)使用 'animation.FuncAnimation()' – 2013-04-08 21:22:20