我需要为这个项目弄个数字。现在我得到了90%。但是,我希望我的身材具有逐渐变化的颜色,红色和黑色的混合。 python中有什么我可以实现的吗?
import numpy as np
from matplotlib import cm, colors
import matplotlib.pyplot as plt
import scipy.special as sp
from mpl_toolkits.mplot3d import Axes3D
phi, theta = np.mgrid[0:2*np.pi:300j, 0:np.pi:150j]
Y30 = sp.sph_harm(0, 3, phi, theta).real
Y20 = sp.sph_harm(0, 2, phi, theta).real
R0 = 1
alpha30 = 0.1
alpha20 = 0.02
prefactor = alpha30*Y30 + alpha20 * Y20 +1
X = R0 * prefactor * np.sin(theta) * np.cos(phi)
Y = R0 * prefactor * np.sin(theta) * np.sin(phi)
Z = R0 * prefactor * np.cos(theta)
norm = colors.Normalize()
fig, ax = plt.subplots(subplot_kw=dict(projection='3d'), figsize=(10.5,10))
m = cm.ScalarMappable(cmap=cm.jet)
# hide the background axes
plt.axis('off')
# change the view
ax.view_init(1, )
ax.plot_surface(X, Y, Z, rstride=10, cstride=10, color = 'orangered', edgecolors='k',shade = True)
m.set_array(R0)
我不需要我的身材完全相同。我只希望它具有红色和黑色的某种混合,并逐渐变化。我将非常感谢您的帮助。