.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/plots/Combined_plotting.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_plots_Combined_plotting.py: ================= Combined Plotting ================= Demonstrate the use of MetPy's simplified plotting interface combining multiple plots. Also shows how to control the maps that are plotted. Plots sample NARR data. .. GENERATED FROM PYTHON SOURCE LINES 13-23 .. code-block:: Python import xarray as xr from metpy.cbook import get_test_data from metpy.plots import ContourPlot, ImagePlot, MapPanel, PanelContainer from metpy.units import units # Use sample NARR data for plotting narr = xr.open_dataset(get_test_data('narr_example.nc', as_file_obj=False)) .. GENERATED FROM PYTHON SOURCE LINES 24-25 Create a contour plot of temperature .. GENERATED FROM PYTHON SOURCE LINES 25-32 .. code-block:: Python contour = ContourPlot() contour.data = narr contour.field = 'Temperature' contour.level = 850 * units.hPa contour.linecolor = 'red' contour.contours = 15 .. GENERATED FROM PYTHON SOURCE LINES 33-34 Create an image plot of Geopotential height .. GENERATED FROM PYTHON SOURCE LINES 34-40 .. code-block:: Python img = ImagePlot() img.data = narr img.field = 'Geopotential_height' img.level = 850 * units.hPa .. GENERATED FROM PYTHON SOURCE LINES 41-42 Plot the data on a map .. GENERATED FROM PYTHON SOURCE LINES 42-52 .. code-block:: Python panel = MapPanel() panel.area = 'us' panel.layers = ['coastline', 'borders', 'states', 'rivers', 'ocean', 'land'] panel.title = 'NARR Example' panel.plots = [contour, img] pc = PanelContainer() pc.size = (10, 8) pc.panels = [panel] pc.show() .. image-sg:: /examples/plots/images/sphx_glr_Combined_plotting_001.png :alt: NARR Example :srcset: /examples/plots/images/sphx_glr_Combined_plotting_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 5.285 seconds) .. _sphx_glr_download_examples_plots_Combined_plotting.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: Combined_plotting.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: Combined_plotting.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: Combined_plotting.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_