python animation函数_使用python中的FuncAnimation画Gif图#1

本文介绍了如何利用matplotlib.animation中的FuncAnimation函数创建随时间变化的动态图像,如波动等物理过程。FuncAnimation函数需要一个函数来处理每一帧的数据更新,并提供帧数据源。文章通过两个实例展示了如何画出向上移动的直线和围绕圆心旋转的直线的GIF动画。
摘要由CSDN通过智能技术生成

为了更好的表示物理过程,比如波,我们需要画出随时间变化的图像,这时就需要引用from matplotlib.animation中的FuncAnimation函数

函数解析

matplotlib.animation.FuncAnimation(fig, func, frames=None, \

init_func=None, fargs=None, save_count=None, *, cache_frame_data=True, **kwargs)

The figure object that is used to get draw, resize, and any other needed events.funccallable

The function to call at each frame. The first argument will be the next value in frames. Any additional positional arguments can be supplied via the fargs parameter.

The required signature is:

def func(frame, *fargs) -> iterable_of_artists

If blit == True, func must return an iterable of all artists that were modified or created. This information is used by the blitting algorithm to determine which parts of the figure have to be updated. The return value is unused if blit == False and may be omitted in that

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值