三维曲面(纯色)
使用纯色演示3D表面的基本图。

# This import registers the 3D projection, but is otherwise unused.from mpl_toolkits.mplot3d import Axes3D # noqa: F401 unused importimport matplotlib.pyplot as pltimport numpy as npfig = plt.figure()ax = fig.add_subplot(111, projection='3d')# Make datau = 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))# Plot the surfaceax.plot_surface(x, y, z, color='b')plt.show()
