我想要動畫一個圓形的數組,以便它們隨時間變化。在python/matplotlib中動畫修補程序對象
import numpy as np
from matplotlib import pyplot as plt
from matplotlib import animation
nx = 20
ny = 20
fig = plt.figure()
plt.axis([0,nx,0,ny])
ax = plt.gca()
ax.set_aspect(1)
for x in range(0,nx):
for y in range(0,ny):
ax.add_patch(plt.Circle((x+0.5,y+0.5),0.45,color='r'))
plt.show()
如何定義的功能init()和動畫(),這樣我可以使用例如產生動畫:
animation.FuncAnimation(fig, animate, initfunc=init,interval=200, blit=True)
見來評論[這個問題](http://stackoverflow.com/questions/19955073/simple-matplotlib-animation)與一些鏈接例子 –