Skip to content

Commit

Permalink
rebase fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
kgoebber committed Sep 14, 2024
1 parent 4c78acd commit 9e4d75d
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 @@ -225,6 +225,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 @@ -8,6 +8,7 @@
from unittest.mock import patch, PropertyMock
import warnings

import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
Expand All @@ -25,6 +26,8 @@
from metpy.testing import get_upper_air_data, needs_cartopy, version_check
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 @@ -2244,7 +2247,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 @@ -2272,7 +2276,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 @@ -46,23 +46,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 9e4d75d

Please sign in to comment.