.. note:: :class: sphx-glr-download-link-note Click :ref:`here ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_gallery_mplot3d_surface3d_2.py: ======================== 3D surface (solid color) ======================== Demonstrates a very basic plot of a 3D surface using a solid color. .. image:: /gallery/mplot3d/images/sphx_glr_surface3d_2_001.png :class: sphx-glr-single-img .. code-block:: default # This import registers the 3D projection, but is otherwise unused. from mpl_toolkits.mplot3d import Axes3D # noqa: F401 unused import import matplotlib.pyplot as plt import numpy as np fig = plt.figure() ax = fig.add_subplot(111, projection='3d') # Make data 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)) # Plot the surface ax.plot_surface(x, y, z) plt.show() .. _sphx_glr_download_gallery_mplot3d_surface3d_2.py: .. only :: html .. container:: sphx-glr-footer :class: sphx-glr-footer-example .. container:: sphx-glr-download :download:`Download Python source code: surface3d_2.py ` .. container:: sphx-glr-download :download:`Download Jupyter notebook: surface3d_2.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature Keywords: matplotlib code example, codex, python plot, pyplot `Gallery generated by Sphinx-Gallery `_