python(matplotlib9)——animation动画
生活随笔
收集整理的這篇文章主要介紹了
python(matplotlib9)——animation动画
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
文章目錄
- 前言
前言
來自 莫煩python的總結。
from matplotlib import animation fig, ax = plt.subplots()x = np.arange(0,2*np.pi,0.01) line, = ax.plot(x,np.sin(x))def animate(i):line.set_ydata(np.sin(x+i/100))return line,def init():line.set_ydata(np.sin(x))return line,ani = animation.FuncAnimation(fig=fig,func=animate,frames=100,init_func=init,interval=20,blit=False)# interval:多久更新一次 ms;blit:只更新變化的點;frame:更新100個點,有一個點變了就更新 plt.show()總結
以上是生活随笔為你收集整理的python(matplotlib9)——animation动画的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: python(matplotlib8)—
- 下一篇: leetcode(1)485——最大连续