3D红色玫瑰花代码(python

编程入门 行业动态 更新时间:2024-10-15 12:36:04

3D红色<a href=https://www.elefans.com/category/jswz/34/1751772.html style=玫瑰花代码(python"/>

3D红色玫瑰花代码(python

文章目录

    • 运行结果展示
    • 代码
    • 引用来源
    • 小结

运行结果展示

代码


import numpy as np
import matplotlib.pyplot as plt
from matplotlib import cm
fig = plt.figure()
ax = fig.add_subplot(projection='3d')
[x, t] = np.meshgrid(np.array(range(25)) / 24.0, np.arange(0, 575.5, 0.5) / 575 * 30 * np.pi - 4 * np.pi)
p = (np.pi / 2) * np.exp(-t / (8 * np.pi))
change = np.sin(20 * t) / 50
u = 1 - (1 - np.mod(3.3 * t, 2 * np.pi) / np.pi) ** 4 / 2 + change
y = 2 * (x ** 2 - x) ** 2 * np.sin(p)
r = u * (x * np.sin(p) + y * np.cos(p)) * 1.5
h = u * (x * np.cos(p) - y * np.sin(p))
c = plt.get_cmap('gist_heat')
surf = ax.plot_surface(r * np.cos(t), r * np.sin(t), h, rstride=1, cstride=1, cmap=c, linewidth=0, antialiased=True)
ax.set_xticks([])
ax.set_yticks([])
ax.set_zticks([])
plt.show()

引用来源

链接:作者发表的微信文章

小结

非常优秀的代码作者!!!,关注我,有好玩的代码会继续给大家分享

更多推荐

3D红色玫瑰花代码(python

本文发布于:2024-02-06 23:46:04,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1751644.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:玫瑰花   红色   代码   python

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!