@@ -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 ,
@@ -3878,8 +3879,20 @@ def boxplot(self, x, notch=None, sym=None, vert=None, whis=None,
3878
3879
control is provided by the *flierprops* parameter.
3879
3880
3880
3881
vert : bool, default: :rc:`boxplot.vertical`
3881
- If `True`, draws vertical boxes.
3882
- If `False`, draw horizontal boxes.
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 ,
@@ -4214,8 +4226,20 @@ def bxp(self, bxpstats, positions=None, widths=None, vert=True,
4214
4226
The default is ``0.5*(width of the box)``, see *widths*.
4215
4227
4216
4228
vert : bool, default: True
4217
- If `True` (default), makes the boxes vertical.
4218
- If `False`, makes horizontal boxes.
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,20 @@ 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. If both are selected,
4363
+ # vert takes precedence.
4364
+ if vert is not None :
4365
+ _api .warn_deprecated (
4366
+ "3.10" ,
4367
+ name = "vert: bool" ,
4368
+ alternative = "orientation: {'vertical', 'horizontal'}"
4369
+ )
4370
+ orientation = 'vertical' if vert else 'horizontal'
4371
+ _api .check_in_list (['horizontal' , 'vertical' ], orientation = orientation )
4372
+
4337
4373
# vertical or horizontal plot?
4338
- maybe_swap = slice (None ) if vert else slice (None , None , - 1 )
4374
+ maybe_swap = slice (None ) if orientation == 'vertical' else slice (None , None , - 1 )
4339
4375
4340
4376
def do_plot (xs , ys , ** kwargs ):
4341
4377
return self .plot (* [xs , ys ][maybe_swap ], ** kwargs )[0 ]
@@ -4460,7 +4496,7 @@ def do_patch(xs, ys, **kwargs):
4460
4496
artist .set_label (lbl )
4461
4497
4462
4498
if manage_ticks :
4463
- axis_name = "x" if vert else "y"
4499
+ axis_name = "x" if orientation == 'vertical' else "y"
4464
4500
interval = getattr (self .dataLim , f"interval{ axis_name } " )
4465
4501
axis = self ._axis_map [axis_name ]
4466
4502
positions = axis .convert_units (positions )
0 commit comments