diff --git a/lib/matplotlib/axes/_base.py b/lib/matplotlib/axes/_base.py index 24c2d48f9871..14c7deea568b 100644 --- a/lib/matplotlib/axes/_base.py +++ b/lib/matplotlib/axes/_base.py @@ -1096,6 +1096,7 @@ def cla(self): self.stale = True + @property @cbook.deprecated("2.1", alternative="Axes.patch") def axesPatch(self): return self.patch diff --git a/lib/matplotlib/figure.py b/lib/matplotlib/figure.py index 8d4273cfe1b8..eb13d2e5f6dd 100644 --- a/lib/matplotlib/figure.py +++ b/lib/matplotlib/figure.py @@ -369,6 +369,7 @@ def __init__(self, self.clf() self._cachedRenderer = None + @property @cbook.deprecated("2.1", alternative="Figure.patch") def figurePatch(self): return self.patch diff --git a/lib/matplotlib/tests/test_axes.py b/lib/matplotlib/tests/test_axes.py index c0f2c728742d..7d9b5d8639f0 100644 --- a/lib/matplotlib/tests/test_axes.py +++ b/lib/matplotlib/tests/test_axes.py @@ -5319,3 +5319,12 @@ def test_barh_signature(args, kwargs, warning_count): def test_zero_linewidth(): # Check that setting a zero linewidth doesn't error plt.plot([0, 1], [0, 1], ls='--', lw=0) + + +def test_patch_deprecations(): + fig, ax = plt.subplots() + with warnings.catch_warnings(record=True) as w: + assert ax.patch == ax.axesPatch + assert fig.patch == fig.figurePatch + + assert len(w) == 2