Skip to content

Commit

Permalink
move rcparam setting to bxp & fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
saranti committed May 14, 2024
1 parent e694393 commit ca45848
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
18 changes: 10 additions & 8 deletions lib/matplotlib/axes/_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -3878,7 +3878,7 @@ def boxplot(self, x, notch=None, sym=None, vert=None,
the fliers. If `None`, then the fliers default to 'b+'. More
control is provided by the *flierprops* parameter.
vert : bool, default: :rc:`boxplot.vertical`
vert : bool, optional
.. deprecated:: 3.10
Use *orientation* instead.
Expand Down Expand Up @@ -4060,8 +4060,6 @@ def boxplot(self, x, notch=None, sym=None, vert=None,
labels=tick_labels, autorange=autorange)
if notch is None:
notch = mpl.rcParams['boxplot.notch']
if vert is None:
vert = mpl.rcParams['boxplot.vertical']
if patch_artist is None:
patch_artist = mpl.rcParams['boxplot.patchartist']
if meanline is None:
Expand Down Expand Up @@ -4227,7 +4225,7 @@ def bxp(self, bxpstats, positions=None, widths=None, vert=None,
Either a scalar or a vector and sets the width of each cap.
The default is ``0.5*(width of the box)``, see *widths*.
vert : bool, default: True
vert : bool, optional
.. deprecated:: 3.10
Use *orientation* instead.
Expand Down Expand Up @@ -4303,6 +4301,7 @@ def bxp(self, bxpstats, positions=None, widths=None, vert=None,
--------
boxplot : Draw a boxplot from data instead of pre-computed statistics.
"""

# Clamp median line to edge of box by default.
medianprops = {
"solid_capstyle": "butt",
Expand Down Expand Up @@ -4361,14 +4360,17 @@ def merge_kw_rc(subkey, explicit, zdelta=0, usemarker=True):
mean_kw[removed_prop] = ''

# vert and orientation parameters are linked until vert's
# deprecation period expires. vert only takes precedence and
# raises a deprecation warning if set to False.
if vert is False:
# deprecation period expires. vert only takes precedence
# if set to False.
if vert is None:
vert = mpl.rcParams['boxplot.vertical']
else:
_api.warn_deprecated(

Check warning on line 4368 in lib/matplotlib/axes/_axes.py

View check run for this annotation

Codecov / codecov/patch

lib/matplotlib/axes/_axes.py#L4368

Added line #L4368 was not covered by tests
"3.10",
name="vert: bool",
alternative="orientation: {'vertical', 'horizontal'}"
)
)
if vert is False:
orientation = 'horizontal'
_api.check_in_list(['horizontal', 'vertical'], orientation=orientation)

Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/tests/test_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -3155,7 +3155,7 @@ def _bxp_test_helper(
logstats = mpl.cbook.boxplot_stats(
np.random.lognormal(mean=1.25, sigma=1., size=(37, 4)), **stats_kwargs)
fig, ax = plt.subplots()
if not bxp_kwargs.get('orientation') or bxp_kwargs.get('orientation') == 'vertical':
if bxp_kwargs.get('orientation', 'vertical') == 'vertical':
ax.set_yscale('log')
else:
ax.set_xscale('log')
Expand Down

0 comments on commit ca45848

Please sign in to comment.