Skip to content

Commit 10b7d65

Browse files
committed
deprecate boxplot:vertical rcparam
1 parent b27dd8b commit 10b7d65

File tree

3 files changed

+19
-10
lines changed

3 files changed

+19
-10
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
``boxplot`` and ``bxp`` *vert* parameter
2-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1+
``boxplot`` and ``bxp`` *vert* parameter, and ``rcParams["boxplot.vertical"]``
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
33

44
The parameter *vert: bool* has been deprecated on `~.Axes.boxplot` and
5-
`~.Axes.bxp`.
6-
It is replaced by *orientation: {"vertical", "horizontal"}* for API
7-
consistency.
5+
`~.Axes.bxp`. It is replaced by *orientation: {"vertical", "horizontal"}*
6+
for API consistency.
7+
8+
``rcParams["boxplot.vertical"]``, which controlled the orientation of ``boxplot``,
9+
is deprecated without replacement.

lib/matplotlib/axes/_axes.py

+12-4
Original file line numberDiff line numberDiff line change
@@ -4060,6 +4060,8 @@ def boxplot(self, x, notch=None, sym=None, vert=None,
40604060
labels=tick_labels, autorange=autorange)
40614061
if notch is None:
40624062
notch = mpl.rcParams['boxplot.notch']
4063+
if vert is None:
4064+
vert = mpl.rcParams['boxplot.vertical']
40634065
if patch_artist is None:
40644066
patch_artist = mpl.rcParams['boxplot.patchartist']
40654067
if meanline is None:
@@ -4359,17 +4361,23 @@ def merge_kw_rc(subkey, explicit, zdelta=0, usemarker=True):
43594361
mean_kw[removed_prop] = ''
43604362

43614363
# vert and orientation parameters are linked until vert's
4362-
# deprecation period expires. If both are selected,
4363-
# vert takes precedence.
4364-
if vert is not None:
4364+
# deprecation period expires. vert only takes precedence and
4365+
# raises a deprecation warning if set to False.
4366+
if vert is False:
43654367
_api.warn_deprecated(
43664368
"3.10",
43674369
name="vert: bool",
43684370
alternative="orientation: {'vertical', 'horizontal'}"
43694371
)
4370-
orientation = 'vertical' if vert else 'horizontal'
4372+
orientation = 'horizontal'
43714373
_api.check_in_list(['horizontal', 'vertical'], orientation=orientation)
43724374

4375+
if not mpl.rcParams['boxplot.vertical']:
4376+
_api.warn_deprecated(
4377+
"3.10",
4378+
name='boxplot.vertical', obj_type="rcparam"
4379+
)
4380+
43734381
# vertical or horizontal plot?
43744382
maybe_swap = slice(None) if orientation == 'vertical' else slice(None, None, -1)
43754383

lib/matplotlib/mpl-data/stylelib/classic.mplstyle

-1
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,6 @@ boxplot.showbox: True
380380
boxplot.showcaps: True
381381
boxplot.showfliers: True
382382
boxplot.showmeans: False
383-
boxplot.vertical: True
384383
boxplot.whiskerprops.color: b
385384
boxplot.whiskerprops.linestyle: --
386385
boxplot.whiskerprops.linewidth: 1.0

0 commit comments

Comments
 (0)