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

.. only:: html

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

        :ref:`Go to the end <sphx_glr_download_examples_plotting_plot_three_panel_gridmapdisplay.py>`
        to download the full example code.

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

.. _sphx_glr_examples_plotting_plot_three_panel_gridmapdisplay.py:


===========================================
Create a 3 panel plot using GridMapDisplay
===========================================

An example that creates a 3 panel plot of a PPI, latitude slice,
and longitude slice using xarray and a cartopy background.

.. GENERATED FROM PYTHON SOURCE LINES 10-74



.. image-sg:: /examples/plotting/images/sphx_glr_plot_three_panel_gridmapdisplay_001.png
   :alt:  0.5 km 2011-05-20T10:02:05.479000Z  REF,  38.0 km east of origin 2011-05-20T10:02:05.479000Z  REF,  27.0 km south of origin 2011-05-20T10:02:05.479000Z  REF
   :srcset: /examples/plotting/images/sphx_glr_plot_three_panel_gridmapdisplay_001.png
   :class: sphx-glr-single-img





.. code-block:: Python


    print(__doc__)

    # Author: Jason Hemedinger
    # License: BSD 3 clause

    import cartopy.crs as ccrs
    import matplotlib.pyplot as plt

    import pyart
    from pyart.testing import get_test_data

    # Read in the gridded file, create GridMapDisplay object
    filename = get_test_data("20110520100000_nexrad_grid.nc")
    radar = pyart.io.read_grid(filename)
    display = pyart.graph.GridMapDisplay(radar)

    # Setting projection, figure size, and panel sizes.
    projection = ccrs.PlateCarree()

    fig = plt.figure(figsize=[15, 7])

    map_panel_axes = [0.05, 0.05, 0.4, 0.80]
    x_cut_panel_axes = [0.55, 0.10, 0.4, 0.25]
    y_cut_panel_axes = [0.55, 0.50, 0.4, 0.25]

    # Set parameters.
    level = 1
    vmin = -8
    vmax = 64
    lat = 36.5
    lon = -97.7

    # Panel 1: PPI plot of the second tilt.
    ax1 = fig.add_axes(map_panel_axes, projection=projection)
    display.plot_grid(
        "REF",
        1,
        vmin=vmin,
        vmax=vmax,
        ax=ax1,
        projection=projection,
        cmap="pyart_HomeyerRainbow",
    )
    display.plot_crosshairs(lon=lon, lat=lat)

    # Panel 2: longitude slice
    ax2 = fig.add_axes(x_cut_panel_axes)
    display.plot_longitude_slice(
        "REF", lon=lon, lat=lat, ax=ax2, vmin=vmin, vmax=vmax, cmap="pyart_HomeyerRainbow"
    )

    ax2.set_ylim([0, 15])
    ax2.set_xlim([-50, 50])

    # Panel 3: latitude slice
    ax3 = fig.add_axes(y_cut_panel_axes)
    display.plot_latitude_slice(
        "REF", lon=lon, lat=lat, ax=ax3, vmin=vmin, vmax=vmax, cmap="pyart_HomeyerRainbow"
    )
    ax3.set_ylim([0, 15])
    ax3.set_xlim([-50, 50])

    plt.show()


.. rst-class:: sphx-glr-timing

   **Total running time of the script:** (0 minutes 17.150 seconds)


.. _sphx_glr_download_examples_plotting_plot_three_panel_gridmapdisplay.py:

.. only:: html

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

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

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

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

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

    .. container:: sphx-glr-download sphx-glr-download-zip

      :download:`Download zipped: plot_three_panel_gridmapdisplay.zip <plot_three_panel_gridmapdisplay.zip>`


.. only:: html

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

    `Gallery generated by Sphinx-Gallery <https://sphinx-gallery.github.io>`_
