莫烦Matplotlib可视化第五章动画代码学习
生活随笔
收集整理的這篇文章主要介紹了
莫烦Matplotlib可视化第五章动画代码学习
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
5.1 Animation 動(dòng)畫(huà)
import numpy as np import matplotlib.pyplot as plt from matplotlib import animationfig,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/10))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)plt.show()總結(jié)
以上是生活随笔為你收集整理的莫烦Matplotlib可视化第五章动画代码学习的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 梦到买桔子是什么意思
- 下一篇: 图像灰度化与二值化