Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf2b91b5

Browse files
committed
add tim's suggestion and fix docs
1 parentd99c8e0 commitf2b91b5

File tree

3 files changed

+29
-35
lines changed

3 files changed

+29
-35
lines changed

‎lib/matplotlib/axes/_axes.py

Lines changed: 25 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -8350,10 +8350,10 @@ def matshow(self, Z, **kwargs):
83508350

83518351
@_api.make_keyword_only("3.9","vert")
83528352
@_preprocess_data(replace_names=["dataset"])
8353-
defviolinplot(self,dataset,positions=None,vert=None,widths=0.5,
8354-
showmeans=False,showextrema=True,showmedians=False,
8355-
quantiles=None,points=100,bw_method=None,side='both',
8356-
orientation=None):
8353+
defviolinplot(self,dataset,positions=None,vert=None,
8354+
orientation='vertical',widths=0.5,showmeans=False,
8355+
showextrema=True,showmedians=False,quantiles=None,
8356+
points=100,bw_method=None,side='both',):
83578357
"""
83588358
Make a violin plot.
83598359
@@ -8381,6 +8381,12 @@ def violinplot(self, dataset, positions=None, vert=None, widths=0.5,
83818381
If True, plots the violins vertically.
83828382
If False, plots the violins horizontally.
83838383
8384+
orientation : {'vertical', 'horizontal'}, default: 'vertical'
8385+
If 'horizontal', plots the violins horizontally.
8386+
Otherwise, plots the violins vertically.
8387+
8388+
.. versionadded:: 3.10
8389+
83848390
widths : float or array-like, default: 0.5
83858391
The maximum width of each violin in units of the *positions* axis.
83868392
The default is 0.5, which is half the available space when using default
@@ -8414,12 +8420,6 @@ def violinplot(self, dataset, positions=None, vert=None, widths=0.5,
84148420
'both' plots standard violins. 'low'/'high' only
84158421
plots the side below/above the positions value.
84168422
8417-
orientation : {'vertical', 'horizontal'}, default: 'vertical'
8418-
If 'horizontal', plots the violins horizontally.
8419-
Otherwise, plots the violins vertically.
8420-
8421-
.. versionadded:: 3.10
8422-
84238423
data : indexable object, optional
84248424
DATA_PARAMETER_PLACEHOLDER
84258425
@@ -8475,9 +8475,9 @@ def _kde_method(X, coords):
84758475
showmedians=showmedians,side=side)
84768476

84778477
@_api.make_keyword_only("3.9","vert")
8478-
defviolin(self,vpstats,positions=None,vert=None,widths=0.5,
8479-
showmeans=False,showextrema=True,showmedians=False,side='both',
8480-
orientation=None):
8478+
defviolin(self,vpstats,positions=None,vert=None,
8479+
orientation=None,widths=0.5,showmeans=False,
8480+
showextrema=True,showmedians=False,side='both'):
84818481
"""
84828482
Draw a violin plot from pre-computed statistics.
84838483
@@ -8525,6 +8525,12 @@ def violin(self, vpstats, positions=None, vert=None, widths=0.5,
85258525
If True, plots the violins vertically.
85268526
If False, plots the violins horizontally.
85278527
8528+
orientation : {'vertical', 'horizontal'}, default: 'vertical'
8529+
If 'horizontal', plots the violins horizontally.
8530+
Otherwise, plots the violins vertically.
8531+
8532+
.. versionadded:: 3.10
8533+
85288534
widths : float or array-like, default: 0.5
85298535
The maximum width of each violin in units of the *positions* axis.
85308536
The default is 0.5, which is half available space when using default
@@ -8543,12 +8549,6 @@ def violin(self, vpstats, positions=None, vert=None, widths=0.5,
85438549
'both' plots standard violins. 'low'/'high' only
85448550
plots the side below/above the positions value.
85458551
8546-
orientation : {'vertical', 'horizontal'}, default: 'vertical'
8547-
If 'horizontal', plots the violins horizontally.
8548-
Otherwise, plots the violins vertically.
8549-
8550-
.. versionadded:: 3.10
8551-
85528552
Returns
85538553
-------
85548554
dict
@@ -8599,23 +8599,17 @@ def violin(self, vpstats, positions=None, vert=None, widths=0.5,
85998599
datashape_message= ("List of violinplot statistics and `{0}` "
86008600
"values must have the same length")
86018601

8602+
# vert and orientation parameters are linked until vert's
8603+
# deprecation period expires. If both are selected,
8604+
# vert takes precedence.
86028605
ifvertisnotNone:
86038606
_api.warn_deprecated(
86048607
"3.10",
86058608
name="vert: bool",
86068609
alternative="orientation: {'vertical', 'horizontal'}"
8607-
)
8608-
8609-
# vert and orientation parameters are linked until vert's
8610-
# deprecation period expires. If both are selected,
8611-
# vert takes precedence.
8612-
ifvertorvertisNoneandorientationisNone:
8613-
orientation='vertical'
8614-
elifvertisFalse:
8615-
orientation='horizontal'
8616-
8617-
iforientationisnotNone:
8618-
_api.check_in_list(['horizontal','vertical'],orientation=orientation)
8610+
)
8611+
orientation='vertical'ifvertelse'horizontal'
8612+
_api.check_in_list(['horizontal','vertical'],orientation=orientation)
86198613

86208614
# Validate positions
86218615
ifpositionsisNone:

‎lib/matplotlib/axes/_axes.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -740,6 +740,7 @@ class Axes(_AxesBase):
740740
positions:ArrayLike|None= ...,
741741
*,
742742
vert:bool|None= ...,
743+
orientation:Literal["vertical","horizontal"]= ...,
743744
widths:float|ArrayLike= ...,
744745
showmeans:bool= ...,
745746
showextrema:bool= ...,
@@ -751,7 +752,6 @@ class Axes(_AxesBase):
751752
|Callable[[GaussianKDE],float]
752753
|None= ...,
753754
side:Literal["both","low","high"]= ...,
754-
orientation:Literal["vertical","horizontal"]|None= ...,
755755
data=...,
756756
)->dict[str,Collection]: ...
757757
defviolin(
@@ -760,12 +760,12 @@ class Axes(_AxesBase):
760760
positions:ArrayLike|None= ...,
761761
*,
762762
vert:bool|None= ...,
763+
orientation:Literal["vertical","horizontal"]|None= ...,
763764
widths:float|ArrayLike= ...,
764765
showmeans:bool= ...,
765766
showextrema:bool= ...,
766767
showmedians:bool= ...,
767768
side:Literal["both","low","high"]= ...,
768-
orientation:Literal["vertical","horizontal"]|None= ...,
769769
)->dict[str,Collection]: ...
770770

771771
table=mtable.table

‎lib/matplotlib/pyplot.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4143,6 +4143,7 @@ def violinplot(
41434143
dataset:ArrayLike|Sequence[ArrayLike],
41444144
positions:ArrayLike|None=None,
41454145
vert:bool|None=None,
4146+
orientation:Literal["vertical","horizontal"]="vertical",
41464147
widths:float|ArrayLike=0.5,
41474148
showmeans:bool=False,
41484149
showextrema:bool=True,
@@ -4154,14 +4155,14 @@ def violinplot(
41544155
|Callable[[GaussianKDE],float]
41554156
|None=None,
41564157
side:Literal["both","low","high"]="both",
4157-
orientation:Literal["vertical","horizontal"]|None=None,
41584158
*,
41594159
data=None,
41604160
)->dict[str,Collection]:
41614161
returngca().violinplot(
41624162
dataset,
41634163
positions=positions,
41644164
vert=vert,
4165+
orientation=orientation,
41654166
widths=widths,
41664167
showmeans=showmeans,
41674168
showextrema=showextrema,
@@ -4170,7 +4171,6 @@ def violinplot(
41704171
points=points,
41714172
bw_method=bw_method,
41724173
side=side,
4173-
orientation=orientation,
41744174
**({"data":data}ifdataisnotNoneelse {}),
41754175
)
41764176

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp