补充知识:jupyter不能显示Matplotlib 动画
看莫烦老师的matplotlib教程中,有一段sinx函数动画,用Jupyter跑却不能显示动画效果。...matplotlib.pyplot as plt
from matplotlib import animation
fig, ax = plt.subplots()
x =np.arange(0,2*np.pi,0.01)
# 返回的是个列表...np.sin(x+i/10))
return line,
def init():
line.set_ydata(np.sin(x))
return line,
# interval 是更新的频率...,隔多少毫秒更新一次,这里是隔20ms更新一次
# blit=True,只更新有变化的点
ani = animation.FuncAnimation(fig=fig,func=animate,frames...=100,init_func=init,interval =20,blit=False)
plt.show()
以上这篇解决matplotlib.pyplot在Jupyter notebook中不显示图像问题就是小编分享给大家的全部内容了