Skip to content

Commit

Permalink
Delay warning for deprecated parameter 'vert' of box and violin
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ksunden committed Nov 18, 2024
1 parent 183b04f commit 41ee6b2
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions lib/matplotlib/axes/_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -4360,11 +4360,15 @@ def merge_kw_rc(subkey, explicit, zdelta=0, usemarker=True):
if vert is None:
vert = mpl.rcParams['boxplot.vertical']
else:
_api.warn_deprecated(
"3.10",
name="vert: bool",
alternative="orientation: {'vertical', 'horizontal'}"
)
pass
# Deprecation warning delayed as the alternative was only introduced in 3.10
#
# _api.warn_deprecated(
# "3.11",
# name="vert: bool",
# alternative="orientation: {'vertical', 'horizontal'}",
# pending=True,
# )
if vert is False:
orientation = 'horizontal'
_api.check_in_list(['horizontal', 'vertical'], orientation=orientation)
Expand Down Expand Up @@ -8641,11 +8645,14 @@ def violin(self, vpstats, positions=None, vert=None,
# deprecation period expires. If both are selected,
# vert takes precedence.
if vert is not None:
_api.warn_deprecated(
"3.10",
name="vert: bool",
alternative="orientation: {'vertical', 'horizontal'}"
)
# Deprecation warning delayed as the new api was introduced in 3.10
#
# _api.warn_deprecated(
# "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)

Expand Down

0 comments on commit 41ee6b2

Please sign in to comment.