.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/plots/Simple_Fronts_Plot.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_Simple_Fronts_Plot.py: ========================= Simple Plotting of Fronts ========================= This uses MetPy's path effects for matplotlib that can be used to represent a line as a traditional front. This example relies on already having location information for the boundaries you would like to plot. .. GENERATED FROM PYTHON SOURCE LINES 12-18 .. code-block:: default import matplotlib.pyplot as plt import numpy as np from metpy.plots import ColdFront, WarmFront .. GENERATED FROM PYTHON SOURCE LINES 19-20 Define some synthetic points to represent the low pressure system and its frontal boundaries. .. GENERATED FROM PYTHON SOURCE LINES 20-27 .. code-block:: default low_lon, low_lat = -94, 32 cold_lat = np.linspace(low_lat - 0.15, low_lat - 1.75, 100) cold_lon = (low_lon + 0.25) - (cold_lat - (low_lat - 0.5))**2 warm_lon = np.linspace(low_lon + 0.3, low_lon + 5, 100) warm_lat = (low_lat + 0.3) - (warm_lon - (low_lon + 2))**2 / 12 .. GENERATED FROM PYTHON SOURCE LINES 28-30 Draw the low as an "L" using matplotlib's `text()` method, then plot the fronts as standard lines, but add our path effects. .. GENERATED FROM PYTHON SOURCE LINES 30-36 .. code-block:: default fig, ax = plt.subplots(figsize=(8, 8), dpi=150) ax.text(low_lon, low_lat, 'L', color='red', size=30, horizontalalignment='center', verticalalignment='center') ax.plot(cold_lon, cold_lat, 'blue', path_effects=[ColdFront(size=8, spacing=1.5)]) ax.plot(warm_lon, warm_lat, 'red', path_effects=[WarmFront(size=8, spacing=1.5)]) plt.show() .. image-sg:: /examples/plots/images/sphx_glr_Simple_Fronts_Plot_001.png :alt: Simple Fronts Plot :srcset: /examples/plots/images/sphx_glr_Simple_Fronts_Plot_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 0.176 seconds) .. _sphx_glr_download_examples_plots_Simple_Fronts_Plot.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: Simple_Fronts_Plot.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: Simple_Fronts_Plot.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_