猫史档案馆


【Python作品分享】阿基米德螺线【教程贴】

用户:CHZS勇敢的蓝雀kKVoCHZS勇敢的蓝雀kKVo查看:0 回复:1 评论:0 创建时间:2022-09-01T19:46:39


【作品展示】

center_image

 

【作品介绍】

s

 

【作品源代码】

import matplotlib.pyplot as plt
import numpy as np
from matplotlib import animation
fig = plt.figure()
plt.subplot(111, polar=True)
plt.ylim([0, 30])
line, = plt.plot([], [], '--')


def init():
    line.set_data([], [])
    return line,


def animate(i):
    if i != 0:
        theta = np.arange(0, i * np.pi, np.pi / 100)
        line.set_data(theta, theta*3)
    return line,


anim = animation.FuncAnimation(fig, animate, init_func=init,
                               frames=8, interval=300, blit=True)
plt.show()

 

【提示】

部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:

https://python.codemao.cn


回复

上一页1 页 / 共 1下一页
疯狂的ren疯狂的ren

《zheng shi yong》

点赞0


评论