diff --git a/src/metpy/plots/declarative.py b/src/metpy/plots/declarative.py index 19f52e95f98..ac070189d80 100644 --- a/src/metpy/plots/declarative.py +++ b/src/metpy/plots/declarative.py @@ -203,6 +203,20 @@ class PanelTraits(MetPyHasTraits): 'xx-small', 'x-small', 'small', 'medium', 'large', 'x-large', 'xx-large'. """ + left_title = Unicode(allow_none=True, default_value=None) + left_title.__doc__ = """A string to set a title for the figure with the location on the + top left of the figure. + + This trait sets a user-defined title that will plot at the top left of the figure. + """ + + right_title = Unicode(allow_none=True, default_value=None) + right_title.__doc__ = """A string to set a title for the figure with the location on the + top right of the figure. + + This trait sets a user-defined title that will plot at the top right of the figure. + """ + plots = List(Any()) plots.__doc__ = """A list of handles that represent the plots (e.g., `ContourPlot`, `FilledContourPlot`, `ImagePlot`, `SkewPlot`) to put on a given panel. diff --git a/tests/plots/test_declarative.py b/tests/plots/test_declarative.py index 63928ce7e47..f7d6f3bc944 100644 --- a/tests/plots/test_declarative.py +++ b/tests/plots/test_declarative.py @@ -7,6 +7,7 @@ from io import BytesIO import warnings +import matplotlib import matplotlib.pyplot as plt import numpy as np import pandas as pd @@ -24,6 +25,8 @@ from metpy.testing import get_upper_air_data, needs_cartopy from metpy.units import units +MPL_VERSION = matplotlib.__version__[:5] + @pytest.mark.mpl_image_compare(remove_text=True, tolerance=0.02) @needs_cartopy @@ -2061,7 +2064,8 @@ def test_declarative_plot_geometry_points(ccrs): return pc.figure -@pytest.mark.mpl_image_compare(remove_text=True, tolerance=0.03) +@pytest.mark.mpl_image_compare(remove_text=True, + tolerance=3.27 if MPL_VERSION.startswith('3.3') else 0.03) def test_declarative_skewt_plot(): """Test plotting of a simple skewT with declarative.""" date = datetime(2016, 5, 22, 0) @@ -2089,7 +2093,8 @@ def test_declarative_skewt_plot(): return panel.figure -@pytest.mark.mpl_image_compare(remove_text=True, tolerance=0.03) +@pytest.mark.mpl_image_compare(remove_text=True, + tolerance=3.24 if MPL_VERSION.startswith('3.3') else 0.03) def test_declarative_skewt_plot_shade_cape(): """Test plotting of a skewT with declarative and shading.""" from metpy.calc import parcel_profile diff --git a/tests/plots/test_skewt.py b/tests/plots/test_skewt.py index 5dea1c6a5bf..dceb2914e00 100644 --- a/tests/plots/test_skewt.py +++ b/tests/plots/test_skewt.py @@ -47,23 +47,8 @@ def test_skewt_api(): return fig -@pytest.mark.mpl_image_compare(remove_text=True, style='default', tolerance=0.069) -def test_skewt_labeled_lines(): - """Test the SkewT with the labeled plot lines function.""" - fig = plt.figure(figsize=(8.5, 11)) - skew = SkewT(fig, rotation=45) - - # Set sensible axis limits - skew.ax.set_ylim(1000, 100) - skew.ax.set_xlim(-30, 50) - - # Add the relevant special lines - skew.plot_labeled_skewt_lines() - - return fig - - -@pytest.mark.mpl_image_compare(remove_text=True, style='default', tolerance=0.069) +@pytest.mark.mpl_image_compare(remove_text=True, style='default', + tolerance=1.99 if MPL_VERSION.startswith('3.3') else 0.069) def test_skewt_labeled_lines(): """Test the SkewT with the labeled plot lines function.""" fig = plt.figure(figsize=(8.5, 11))