matplotlib animation
2024-09-05 07:18:42
import numpy as np
from matplotlib import pyplot as plt
from matplotlib import animation fig, ax = plt.subplots()
x = np.arange(0, 2*np.pi, 0.01)
print(len(x))
print(x)
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, # func 表示animation的动画, frames表示100个时间点, init_func 表示初始点,
# inyterval 表示每隔多少时间点刷新 一次, blit是否是全部更新, 如果为FLASE则更新需要更新的点
ani = animation.FuncAnimation(fig=fig, func=animate, frames=100, init_func=init, interval=20, blit=False) plt.savefig('./image_dir/animation.png')
plt.tight_layout()
plt.show()
最新文章
- linq分页组合查询
- 基础SQL语句/语法
- H5项目常见问题及注意事项
- FusionCharts简单教程(四)-----基本数字格式
- MVC的路径查找顺序
- CI框架源码分析
- 2.HTML5 标准改变,准备工作
- 为Elasticsearch添加中文分词,对比分词器效果
- mongodb数据库设计原则
- hdu 5497 Inversion 树状数组 逆序对,单点修改
- Cortex-mo指令集
- 子进程 已安装 post-installation 脚本 返回错误状态 1,dpkg: 处理软件包 python-crypto (--configure)时出错: 该软件包正处于非常不稳定的状态;
- h5 动画页面
- LeetCode(55)- Palindrome Linked List
- jquery touch 移动端上下滑动加载
- 通过安全网闸访问MongoDB
- 复制粘贴插件(不包含 Flash)——clipboard.js
- U盘安装centos7 关键步骤
- 4-23 模块 hashlib ,configparser,loging,collections
- java解决手机上传竖拍照片旋转90\180\270度问题
热门文章
- Spring 为啥默认把bean设计成单例的?
- mybatis中<;![CDATA[]]>;和转义字符
- 纯前端实现词云展示+附微博热搜词云Demo代码
- CodeBlocks调试器缺少(gdb.exe)文件
- NLP 开源形近字算法补完计划(完结篇)
- 没有人比我更会使用集合!对, 是dart中的集合
- 【Linux】(1)安装
- maven私服-仓库图
- 压力测试工具——apchebench(简称ab)
- Excel-返回列表或数据库中的分类汇总(汇总可以实现要还是不要统计隐藏行功能) subtotal()