@@ -8302,9 +8302,10 @@ def matshow(self, Z, **kwargs):
83028302 return im
83038303
83048304 @_preprocess_data (replace_names = ["dataset" ])
8305- def violinplot (self , dataset , positions = None , vert = True , widths = 0.5 ,
8305+ def violinplot (self , dataset , positions = None , vert = None , widths = 0.5 ,
83068306 showmeans = False , showextrema = True , showmedians = False ,
8307- quantiles = None , points = 100 , bw_method = None , side = 'both' ):
8307+ quantiles = None , points = 100 , bw_method = None , side = 'both' ,
8308+ orientation = None ):
83088309 """
83098310 Make a violin plot.
83108311
@@ -8323,8 +8324,14 @@ def violinplot(self, dataset, positions=None, vert=True, widths=0.5,
83238324 vertical violins (or y-axis for horizontal violins).
83248325
83258326 vert : bool, default: True.
8326- If true, creates a vertical violin plot.
8327- Otherwise, creates a horizontal violin plot.
8327+ .. deprecated:: 3.10
8328+ Use *orientation* instead.
8329+
8330+ If this is given during the deprecation period, it overrides
8331+ the *orientation* parameter.
8332+
8333+ If True, plots the violins vertically.
8334+ If False, plots the violins horizontally.
83288335
83298336 widths : float or array-like, default: 0.5
83308337 The maximum width of each violin in units of the *positions* axis.
@@ -8359,6 +8366,12 @@ def violinplot(self, dataset, positions=None, vert=True, widths=0.5,
83598366 'both' plots standard violins. 'low'/'high' only
83608367 plots the side below/above the positions value.
83618368
8369+ orientation : {'vertical', 'horizontal'}, default: 'vertical'
8370+ If 'horizontal', plots the violins horizontally.
8371+ Otherwise, plots the violins vertically.
8372+
8373+ .. versionadded:: 3.10
8374+
83628375 data : indexable object, optional
83638376 DATA_PARAMETER_PLACEHOLDER
83648377
@@ -8409,11 +8422,13 @@ def _kde_method(X, coords):
84098422 vpstats = cbook .violin_stats (dataset , _kde_method , points = points ,
84108423 quantiles = quantiles )
84118424 return self .violin (vpstats , positions = positions , vert = vert ,
8412- widths = widths , showmeans = showmeans ,
8413- showextrema = showextrema , showmedians = showmedians , side = side )
8425+ orientation = orientation , widths = widths ,
8426+ showmeans = showmeans , showextrema = showextrema ,
8427+ showmedians = showmedians , side = side )
84148428
8415- def violin (self , vpstats , positions = None , vert = True , widths = 0.5 ,
8416- showmeans = False , showextrema = True , showmedians = False , side = 'both' ):
8429+ def violin (self , vpstats , positions = None , vert = None , widths = 0.5 ,
8430+ showmeans = False , showextrema = True , showmedians = False , side = 'both' ,
8431+ orientation = None ):
84178432 """
84188433 Draw a violin plot from pre-computed statistics.
84198434
@@ -8452,8 +8467,14 @@ def violin(self, vpstats, positions=None, vert=True, widths=0.5,
84528467 vertical violins (or y-axis for horizontal violins).
84538468
84548469 vert : bool, default: True.
8455- If true, plots the violins vertically.
8456- Otherwise, plots the violins horizontally.
8470+ .. deprecated:: 3.10
8471+ Use *orientation* instead.
8472+
8473+ If this is given during the deprecation period, it overrides
8474+ the *orientation* parameter.
8475+
8476+ If True, plots the violins vertically.
8477+ If False, plots the violins horizontally.
84578478
84588479 widths : float or array-like, default: 0.5
84598480 The maximum width of each violin in units of the *positions* axis.
@@ -8473,6 +8494,12 @@ def violin(self, vpstats, positions=None, vert=True, widths=0.5,
84738494 'both' plots standard violins. 'low'/'high' only
84748495 plots the side below/above the positions value.
84758496
8497+ orientation : {'vertical', 'horizontal'}, default: 'vertical'
8498+ If 'horizontal', plots the violins horizontally.
8499+ Otherwise, plots the violins vertically.
8500+
8501+ .. versionadded:: 3.10
8502+
84768503 Returns
84778504 -------
84788505 dict
@@ -8523,6 +8550,24 @@ def violin(self, vpstats, positions=None, vert=True, widths=0.5,
85238550 datashape_message = ("List of violinplot statistics and `{0}` "
85248551 "values must have the same length" )
85258552
8553+ if vert is not None :
8554+ _api .warn_deprecated (
8555+ "3.10" ,
8556+ name = "vert: bool" ,
8557+ alternative = "orientation: {'vertical', 'horizontal'}"
8558+ )
8559+
8560+ # vert and orientation parameters are linked until vert's
8561+ # deprecation period expires. If both are selected,
8562+ # vert takes precedence.
8563+ if vert or vert is None and orientation is None :
8564+ orientation = 'vertical'
8565+ elif vert is False :
8566+ orientation = 'horizontal'
8567+
8568+ if orientation is not None :
8569+ _api .check_in_list (['horizontal' , 'vertical' ], orientation = orientation )
8570+
85268571 # Validate positions
85278572 if positions is None :
85288573 positions = range (1 , N + 1 )
@@ -8551,7 +8596,7 @@ def violin(self, vpstats, positions=None, vert=True, widths=0.5,
85518596 fillcolor = linecolor = self ._get_lines .get_next_color ()
85528597
85538598 # Check whether we are rendering vertically or horizontally
8554- if vert :
8599+ if orientation == 'vertical' :
85558600 fill = self .fill_betweenx
85568601 if side in ['low' , 'high' ]:
85578602 perp_lines = functools .partial (self .hlines , colors = linecolor ,
0 commit comments