from matplotlib import cm
import matplotlib.pyplot as plt
import numpy as np
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*17*np.pi-2*np.pi)
p = (np.pi/2)*np.exp(-t/(8*np.pi))
u = 1-(1-np.mod(3.6*t, 2*np.pi)/np.pi)**4/2
y = 2*(x**2-x)**2*np.sin(p)
r = u*(x*np.sin(p)+y*np.cos(p))
surf = ax.plot_surface(r*np.cos(t), r*np.sin(t),u*(x*np.cos(p)-y*np.sin(p)), rstride=1, cstride=1,
cmap=cm.Reds_r,linewidth=0, antialiased=True)
# 自己设置文字内容和显示设置
ax.text(-0.3, 0, 1.2, 'love you ~', color='red')
plt.axis('off')
plt.show()
文章来源地址https://www.toymoban.com/news/detail-712778.html
文章来源:https://www.toymoban.com/news/detail-712778.html
到了这里,关于python绘制立体玫瑰花的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!