.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/plot_05_3d_views.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_examples_plot_05_3d_views.py: Viewing 3D Axes =============== Matplotview has built-in support for viewing 3D axes and plots. .. GENERATED FROM PYTHON SOURCE LINES 7-30 .. image-sg:: /examples/images/sphx_glr_plot_05_3d_views_001.png :alt: plot 05 3d views :srcset: /examples/images/sphx_glr_plot_05_3d_views_001.png :class: sphx-glr-single-img .. code-block:: default :lineno-start: 7 import matplotlib.pyplot as plt import numpy as np from matplotview import view X = Y = np.arange(-5, 5, 0.25) X, Y = np.meshgrid(X, Y) Z = np.sin(np.sqrt(X ** 2 + Y ** 2)) # Make some 3D plots... fig, (ax1, ax2) = plt.subplots(1, 2, subplot_kw=dict(projection="3d")) # Plot our surface ax1.plot_surface(X, Y, Z, cmap="plasma") # Axes 2 is now viewing axes 1. view(ax2, ax1) # Update the limits, and set the elevation higher, so we get a better view of the inside of the surface. ax2.view_init(elev=80) ax2.set_xlim(-10, 10) ax2.set_ylim(-10, 10) ax2.set_zlim(-2, 2) fig.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.703 seconds) .. _sphx_glr_download_examples_plot_05_3d_views.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_05_3d_views.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_05_3d_views.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_