From f5ce78986c86720000b85ea1345ff993a66db232 Mon Sep 17 00:00:00 2001 From: Kyle Sunden Date: Mon, 18 Nov 2024 17:16:45 -0600 Subject: [PATCH 1/3] Delay warning for deprecated parameter 'vert' of box and violin The new parameter, 'orientation', was only added in the current release, so downstream wanting to avoid warnings would require version gates. Therefore delaying by at least one release to ease the transition. This was motivated by Pandas failing tests on this warning. --- lib/matplotlib/axes/_axes.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index f6a4ebfdc7c6..25552673aa33 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -3875,7 +3875,7 @@ def boxplot(self, x, notch=None, sym=None, vert=None, control is provided by the *flierprops* parameter. vert : bool, optional - .. deprecated:: 3.10 + .. deprecated:: 3.11 Use *orientation* instead. If this is given during the deprecation period, it overrides @@ -4222,7 +4222,7 @@ def bxp(self, bxpstats, positions=None, widths=None, vert=None, The default is ``0.5*(width of the box)``, see *widths*. vert : bool, optional - .. deprecated:: 3.10 + .. deprecated:: 3.11 Use *orientation* instead. If this is given during the deprecation period, it overrides @@ -4361,9 +4361,10 @@ def merge_kw_rc(subkey, explicit, zdelta=0, usemarker=True): vert = mpl.rcParams['boxplot.vertical'] else: _api.warn_deprecated( - "3.10", + "3.11", name="vert: bool", - alternative="orientation: {'vertical', 'horizontal'}" + alternative="orientation: {'vertical', 'horizontal'}", + pending=True, ) if vert is False: orientation = 'horizontal' @@ -8642,10 +8643,11 @@ def violin(self, vpstats, positions=None, vert=None, # vert takes precedence. if vert is not None: _api.warn_deprecated( - "3.10", + "3.11", name="vert: bool", - alternative="orientation: {'vertical', 'horizontal'}" - ) + alternative="orientation: {'vertical', 'horizontal'}", + pending=True, + ) orientation = 'vertical' if vert else 'horizontal' _api.check_in_list(['horizontal', 'vertical'], orientation=orientation) From 34eb9d3f72b70e808a6af8cc7c5fcb1772314400 Mon Sep 17 00:00:00 2001 From: Kyle Sunden Date: Wed, 20 Nov 2024 14:49:44 -0600 Subject: [PATCH 2/3] remove pending from warning Co-authored-by: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com> --- lib/matplotlib/axes/_axes.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index 25552673aa33..c55f77811859 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -4364,7 +4364,6 @@ def merge_kw_rc(subkey, explicit, zdelta=0, usemarker=True): "3.11", name="vert: bool", alternative="orientation: {'vertical', 'horizontal'}", - pending=True, ) if vert is False: orientation = 'horizontal' @@ -8646,7 +8645,6 @@ def violin(self, vpstats, positions=None, vert=None, "3.11", name="vert: bool", alternative="orientation: {'vertical', 'horizontal'}", - pending=True, ) orientation = 'vertical' if vert else 'horizontal' _api.check_in_list(['horizontal', 'vertical'], orientation=orientation) From f5e81a5373d8ccc89f1156ede57f9bb771e891b2 Mon Sep 17 00:00:00 2001 From: Kyle Sunden Date: Wed, 20 Nov 2024 15:21:07 -0600 Subject: [PATCH 3/3] Fix violin test, change version number in match --- lib/matplotlib/tests/test_axes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/matplotlib/tests/test_axes.py b/lib/matplotlib/tests/test_axes.py index e3a59a1751ab..62eb491aa4bb 100644 --- a/lib/matplotlib/tests/test_axes.py +++ b/lib/matplotlib/tests/test_axes.py @@ -9314,7 +9314,7 @@ def test_violinplot_orientation(fig_test, fig_ref): # Deprecation of `vert: bool` keyword with pytest.warns(mpl.MatplotlibDeprecationWarning, - match='vert: bool was deprecated in Matplotlib 3.10'): + match='vert: bool was deprecated in Matplotlib 3.11'): # Compare images between a figure that # uses vert and one that uses orientation. ax_ref = fig_ref.subplots()