曲面
- 代码如下:
import matplotlib.pyplot as plt
import numpy as np
from mpl_toolkits.mplot3d import Axes3D
import math
pi=math.pi
x=np.arange(0,pi*2,0.1)
y=np.arange(0,pi*2,0.1)
x,y=np.meshgrid(x,y)
def zh(x,y):
z=(np.sin(y)+10)*(np.sin(x)+10)*np.exp(np.sin(x))*np.exp(np.sin(y))/100
return z
z=zh(x,y)
print(z)
fig1 = plt.figure('随意瞎建的曲面')
ax = Axes3D(fig1)
plt.title('Turn your head into sky!')
#ax.plot_wireframe(x,y,z,color='c')
ax.plot_surface(x,y,z,cmap=plt.get_cmap('viridis'))
ax.set_zlim(0,10)
ax.set_xlabel('x label',color='r')
ax.set_ylabel('y label',color='g')
ax.set_zlabel('z label',color='b')
plt.show()
运行效果:
-
渲染之后的效果
-
草图效果