python - matplotlib plot_surface plot -


itemprop = "text">

matplotlib tutorial provides a good example of how to draw a spherical suface:

 

Code> mpl_toolkits.mplot3d import np as fig plt import numpy as axes3d import matplotlib.pyplot = plt.figure () ax = fig.add_subplot (111, projection = '3d') u = np.linspace ( 0, 2 * np.pi, 100) V = np.linspace (0, np.pi, 100) x = 10 * np.outer (np.cos (u), np.sin (v)) y = 10 * Np.outer (np.sin (u), np.sin (v)) z = 10 * np.outer (np.ones (np.size (u)), np.cos (v) ax.plot_surface (x , Y, z, rstride = 4, cstride = 4, color = 'b') plt.show ()

What I understand, it creates a 2D grid for each of the x , y , and z of the variable parameters Corresonding with the product u and v . The calculation of the Cartesian coordinates created by the spherical coordinates in the x , y , and z variable then are calculated by U and < Code> v .

My question is: input why plot_surface should be in 2D arrays?

I think this is something to calculate the normals of the face of each surface, but I can not find it.

Something like this seems to ask, but the same answer is not particularly enlightened.


Comments