三维曲面(纯色)

使用纯色演示3D表面的基本图。

三维曲面(纯色)示例

  1. # This import registers the 3D projection, but is otherwise unused.
  2. from mpl_toolkits.mplot3d import Axes3D # noqa: F401 unused import
  3. import matplotlib.pyplot as plt
  4. import numpy as np
  5. fig = plt.figure()
  6. ax = fig.add_subplot(111, projection='3d')
  7. # Make data
  8. u = np.linspace(0, 2 * np.pi, 100)
  9. v = np.linspace(0, np.pi, 100)
  10. x = 10 * np.outer(np.cos(u), np.sin(v))
  11. y = 10 * np.outer(np.sin(u), np.sin(v))
  12. z = 10 * np.outer(np.ones(np.size(u)), np.cos(v))
  13. # Plot the surface
  14. ax.plot_surface(x, y, z, color='b')
  15. plt.show()

下载这个示例