
.. DO NOT EDIT.
.. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY.
.. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE:
.. "gallery/pyplots/whats_new_1_subplot3d.py"
.. LINE NUMBERS ARE GIVEN BELOW.

.. only:: html

    .. note::
        :class: sphx-glr-download-link-note

        Click :ref:`here <sphx_glr_download_gallery_pyplots_whats_new_1_subplot3d.py>`
        to download the full example code

.. rst-class:: sphx-glr-example-title

.. _sphx_glr_gallery_pyplots_whats_new_1_subplot3d.py:


======================
What's New 1 Subplot3d
======================

Create two three-dimensional plots in the same figure.

.. GENERATED FROM PYTHON SOURCE LINES 8-38

.. code-block:: default


    from matplotlib import cm
    #from matplotlib.ticker import LinearLocator, FixedLocator, FormatStrFormatter
    import matplotlib.pyplot as plt
    import numpy as np

    fig = plt.figure()

    ax = fig.add_subplot(1, 2, 1, projection='3d')
    X = np.arange(-5, 5, 0.25)
    Y = np.arange(-5, 5, 0.25)
    X, Y = np.meshgrid(X, Y)
    R = np.sqrt(X**2 + Y**2)
    Z = np.sin(R)
    surf = ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap=cm.viridis,
                           linewidth=0, antialiased=False)
    ax.set_zlim3d(-1.01, 1.01)

    #ax.zaxis.set_major_locator(LinearLocator(10))
    #ax.zaxis.set_major_formatter(FormatStrFormatter('%.03f'))

    fig.colorbar(surf, shrink=0.5, aspect=5)

    from mpl_toolkits.mplot3d.axes3d import get_test_data
    ax = fig.add_subplot(1, 2, 2, projection='3d')
    X, Y, Z = get_test_data(0.05)
    ax.plot_wireframe(X, Y, Z, rstride=10, cstride=10)

    plt.show()




.. image:: /gallery/pyplots/images/sphx_glr_whats_new_1_subplot3d_001.png
    :alt: whats new 1 subplot3d
    :class: sphx-glr-single-img





.. GENERATED FROM PYTHON SOURCE LINES 39-46

------------

References
""""""""""

The use of the following functions, methods, classes and modules is shown
in this example:

.. GENERATED FROM PYTHON SOURCE LINES 47-54

.. code-block:: default


    import matplotlib
    import mpl_toolkits
    matplotlib.figure.Figure.add_subplot
    mpl_toolkits.mplot3d.axes3d.Axes3D.plot_surface
    mpl_toolkits.mplot3d.axes3d.Axes3D.plot_wireframe
    mpl_toolkits.mplot3d.axes3d.Axes3D.set_zlim3d




.. rst-class:: sphx-glr-script-out

 Out:

 .. code-block:: none


    <function Axes3D.set_zlim3d at 0x7f73be881d30>




.. _sphx_glr_download_gallery_pyplots_whats_new_1_subplot3d.py:


.. only :: html

 .. container:: sphx-glr-footer
    :class: sphx-glr-footer-example



  .. container:: sphx-glr-download sphx-glr-download-python

     :download:`Download Python source code: whats_new_1_subplot3d.py <whats_new_1_subplot3d.py>`



  .. container:: sphx-glr-download sphx-glr-download-jupyter

     :download:`Download Jupyter notebook: whats_new_1_subplot3d.ipynb <whats_new_1_subplot3d.ipynb>`


.. only:: html

 .. rst-class:: sphx-glr-signature

    Keywords: matplotlib code example, codex, python plot, pyplot
    `Gallery generated by Sphinx-Gallery
    <https://sphinx-gallery.readthedocs.io>`_
