首页后端开发Pythonanimation函数解析

animation函数解析

时间2023-06-04 20:07:01发布访客分类Python浏览558
导读:animation函数解析?代码示例:import matplotlib.pyplot as pltimport numpy as npfrom matplotlib import animationfig, ax = plt.subplo...

animation函数解析?

代码示例:

import matplotlib.pyplot as plt

import numpy as np

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)

plt.show()

声明:本文内容由网友自发贡献,本站不承担相应法律责任。对本内容有异议或投诉,请联系2913721942#qq.com核实处理,我们将尽快回复您,谢谢合作!


若转载请注明出处: animation函数解析
本文地址: https://pptw.com/jishu/61542.html
python3random库怎么安装 哪些行业哪些工作岗位可以用到人工智能技术

游客 回复需填写必要信息