Skip to content

Commit

Permalink
rebase fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
kgoebber committed Aug 23, 2023
1 parent b9cd362 commit 908160f
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 19 deletions.
14 changes: 14 additions & 0 deletions src/metpy/plots/declarative.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
9 changes: 7 additions & 2 deletions tests/plots/test_declarative.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
19 changes: 2 additions & 17 deletions tests/plots/test_skewt.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit 908160f

Please sign in to comment.