How to draw a three-dimensional image python?

python output three-dimensional image code is as follows: 
# Videos function 3D image output
from mpl_toolkits.mplot3d Import Axes3D
from matplotlib Import cm & lt
Import matplotlib.pyplot AS PLT
Import numpy AS NP
Import mpl_toolkits.mplot3d
Figure plt.figure = ()
#ax = Axes3D (Figure)
AX = figure.gca (Projection = "3D")
X1 = np.linspace (-6,6,1000)
Y1 = np.linspace (-6,6,1000)
X, Y = np.meshgrid ( X1, Y1)
Z = (X + Y-2 **. 11) ** 2+ (Y + X ** 2-7) ** 2
# ax.plot_surface (X, Y, Z, rstride = 10, = cstride . 4, CMap = cm.YlGnBu_r)
ax.plot_surface (X, Y, Z, CMap = "Rainbow")
plt.show ()

outputs three-dimensional image as follows:

 

Guess you like

Origin www.cnblogs.com/Yanjy-OnlyOne/p/11600274.html