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