@@ -3819,9 +3819,10 @@ def apply_mask(arrays, mask):
3819
3819
@_api .make_keyword_only ("3.9" , "notch" )
3820
3820
@_preprocess_data ()
3821
3821
@_api .rename_parameter ("3.9" , "labels" , "tick_labels" )
3822
- def boxplot (self , x , notch = None , sym = None , vert = None , whis = None ,
3823
- positions = None , widths = None , patch_artist = None ,
3824
- bootstrap = None , usermedians = None , conf_intervals = None ,
3822
+ def boxplot (self , x , notch = None , sym = None , vert = None ,
3823
+ orientation = 'vertical' , whis = None , positions = None ,
3824
+ widths = None , patch_artist = None , bootstrap = None ,
3825
+ usermedians = None , conf_intervals = None ,
3825
3826
meanline = None , showmeans = None , showcaps = None ,
3826
3827
showbox = None , showfliers = None , boxprops = None ,
3827
3828
tick_labels = None , flierprops = None , medianprops = None ,
@@ -3877,9 +3878,21 @@ def boxplot(self, x, notch=None, sym=None, vert=None, whis=None,
3877
3878
the fliers. If `None`, then the fliers default to 'b+'. More
3878
3879
control is provided by the *flierprops* parameter.
3879
3880
3880
- vert : bool, default: :rc:`boxplot.vertical`
3881
- If `True`, draws vertical boxes.
3882
- If `False`, draw horizontal boxes.
3881
+ vert : bool, optional
3882
+ .. deprecated:: 3.10
3883
+ Use *orientation* instead.
3884
+
3885
+ If this is given during the deprecation period, it overrides
3886
+ the *orientation* parameter.
3887
+
3888
+ If True, plots the boxes vertically.
3889
+ If False, plots the boxes horizontally.
3890
+
3891
+ orientation : {'vertical', 'horizontal'}, default: 'vertical'
3892
+ If 'horizontal', plots the boxes horizontally.
3893
+ Otherwise, plots the boxes vertically.
3894
+
3895
+ .. versionadded:: 3.10
3883
3896
3884
3897
whis : float or (float, float), default: 1.5
3885
3898
The position of the whiskers.
@@ -4047,8 +4060,6 @@ def boxplot(self, x, notch=None, sym=None, vert=None, whis=None,
4047
4060
labels = tick_labels , autorange = autorange )
4048
4061
if notch is None :
4049
4062
notch = mpl .rcParams ['boxplot.notch' ]
4050
- if vert is None :
4051
- vert = mpl .rcParams ['boxplot.vertical' ]
4052
4063
if patch_artist is None :
4053
4064
patch_artist = mpl .rcParams ['boxplot.patchartist' ]
4054
4065
if meanline is None :
@@ -4148,13 +4159,14 @@ def boxplot(self, x, notch=None, sym=None, vert=None, whis=None,
4148
4159
meanline = meanline , showfliers = showfliers ,
4149
4160
capprops = capprops , whiskerprops = whiskerprops ,
4150
4161
manage_ticks = manage_ticks , zorder = zorder ,
4151
- capwidths = capwidths , label = label )
4162
+ capwidths = capwidths , label = label ,
4163
+ orientation = orientation )
4152
4164
return artists
4153
4165
4154
4166
@_api .make_keyword_only ("3.9" , "widths" )
4155
- def bxp (self , bxpstats , positions = None , widths = None , vert = True ,
4156
- patch_artist = False , shownotches = False , showmeans = False ,
4157
- showcaps = True , showbox = True , showfliers = True ,
4167
+ def bxp (self , bxpstats , positions = None , widths = None , vert = None ,
4168
+ orientation = 'vertical' , patch_artist = False , shownotches = False ,
4169
+ showmeans = False , showcaps = True , showbox = True , showfliers = True ,
4158
4170
boxprops = None , whiskerprops = None , flierprops = None ,
4159
4171
medianprops = None , capprops = None , meanprops = None ,
4160
4172
meanline = False , manage_ticks = True , zorder = None ,
@@ -4213,9 +4225,21 @@ def bxp(self, bxpstats, positions=None, widths=None, vert=True,
4213
4225
Either a scalar or a vector and sets the width of each cap.
4214
4226
The default is ``0.5*(width of the box)``, see *widths*.
4215
4227
4216
- vert : bool, default: True
4217
- If `True` (default), makes the boxes vertical.
4218
- If `False`, makes horizontal boxes.
4228
+ vert : bool, optional
4229
+ .. deprecated:: 3.10
4230
+ Use *orientation* instead.
4231
+
4232
+ If this is given during the deprecation period, it overrides
4233
+ the *orientation* parameter.
4234
+
4235
+ If True, plots the boxes vertically.
4236
+ If False, plots the boxes horizontally.
4237
+
4238
+ orientation : {'vertical', 'horizontal'}, default: 'vertical'
4239
+ If 'horizontal', plots the boxes horizontally.
4240
+ Otherwise, plots the boxes vertically.
4241
+
4242
+ .. versionadded:: 3.10
4219
4243
4220
4244
patch_artist : bool, default: False
4221
4245
If `False` produces boxes with the `.Line2D` artist.
@@ -4334,8 +4358,29 @@ def merge_kw_rc(subkey, explicit, zdelta=0, usemarker=True):
4334
4358
if meanprops is None or removed_prop not in meanprops :
4335
4359
mean_kw [removed_prop ] = ''
4336
4360
4361
+ # vert and orientation parameters are linked until vert's
4362
+ # deprecation period expires. vert only takes precedence
4363
+ # if set to False.
4364
+ if vert is None :
4365
+ vert = mpl .rcParams ['boxplot.vertical' ]
4366
+ else :
4367
+ _api .warn_deprecated (
4368
+ "3.10" ,
4369
+ name = "vert: bool" ,
4370
+ alternative = "orientation: {'vertical', 'horizontal'}"
4371
+ )
4372
+ if vert is False :
4373
+ orientation = 'horizontal'
4374
+ _api .check_in_list (['horizontal' , 'vertical' ], orientation = orientation )
4375
+
4376
+ if not mpl .rcParams ['boxplot.vertical' ]:
4377
+ _api .warn_deprecated (
4378
+ "3.10" ,
4379
+ name = 'boxplot.vertical' , obj_type = "rcparam"
4380
+ )
4381
+
4337
4382
# vertical or horizontal plot?
4338
- maybe_swap = slice (None ) if vert else slice (None , None , - 1 )
4383
+ maybe_swap = slice (None ) if orientation == 'vertical' else slice (None , None , - 1 )
4339
4384
4340
4385
def do_plot (xs , ys , ** kwargs ):
4341
4386
return self .plot (* [xs , ys ][maybe_swap ], ** kwargs )[0 ]
@@ -4460,7 +4505,7 @@ def do_patch(xs, ys, **kwargs):
4460
4505
artist .set_label (lbl )
4461
4506
4462
4507
if manage_ticks :
4463
- axis_name = "x" if vert else "y"
4508
+ axis_name = "x" if orientation == 'vertical' else "y"
4464
4509
interval = getattr (self .dataLim , f"interval{ axis_name } " )
4465
4510
axis = self ._axis_map [axis_name ]
4466
4511
positions = axis .convert_units (positions )
0 commit comments