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

Commitc6932a5

Browse files
committed
add tim's suggestion
1 parentd99c8e0 commitc6932a5

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,orientation='vertical',
8354+
vert=None,widths=0.5,showmeans=False,showextrema=True,
8355+
showmedians=False,quantiles=None,points=100,
8356+
bw_method=None,side='both',):
83578357
"""
83588358
Make a violin plot.
83598359
@@ -8371,6 +8371,12 @@ def violinplot(self, dataset, positions=None, vert=None, widths=0.5,
83718371
The positions of the violins; i.e. coordinates on the x-axis for
83728372
vertical violins (or y-axis for horizontal violins).
83738373
8374+
orientation : {'vertical', 'horizontal'}, default: 'vertical'
8375+
If 'horizontal', plots the violins horizontally.
8376+
Otherwise, plots the violins vertically.
8377+
8378+
.. versionadded:: 3.10
8379+
83748380
vert : bool, default: True.
83758381
.. deprecated:: 3.10
83768382
Use *orientation* instead.
@@ -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,orientation=None,
8479+
vert=None,widths=0.5,showmeans=False,showextrema=True,
8480+
showmedians=False,side='both'):
84818481
"""
84828482
Draw a violin plot from pre-computed statistics.
84838483
@@ -8515,6 +8515,12 @@ def violin(self, vpstats, positions=None, vert=None, widths=0.5,
85158515
The positions of the violins; i.e. coordinates on the x-axis for
85168516
vertical violins (or y-axis for horizontal violins).
85178517
8518+
orientation : {'vertical', 'horizontal'}, default: 'vertical'
8519+
If 'horizontal', plots the violins horizontally.
8520+
Otherwise, plots the violins vertically.
8521+
8522+
.. versionadded:: 3.10
8523+
85188524
vert : bool, default: True.
85198525
.. deprecated:: 3.10
85208526
Use *orientation* instead.
@@ -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
@@ -739,6 +739,7 @@ class Axes(_AxesBase):
739739
dataset:ArrayLike|Sequence[ArrayLike],
740740
positions:ArrayLike|None= ...,
741741
*,
742+
orientation:Literal["vertical","horizontal"]|None= ...,
742743
vert:bool|None= ...,
743744
widths:float|ArrayLike= ...,
744745
showmeans:bool= ...,
@@ -751,21 +752,20 @@ 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(
758758
self,
759759
vpstats:Sequence[dict[str,Any]],
760760
positions:ArrayLike|None= ...,
761761
*,
762+
orientation:Literal["vertical","horizontal"]|None= ...,
762763
vert:bool|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
@@ -4142,6 +4142,7 @@ def triplot(*args, **kwargs):
41424142
defviolinplot(
41434143
dataset:ArrayLike|Sequence[ArrayLike],
41444144
positions:ArrayLike|None=None,
4145+
orientation:Literal["vertical","horizontal"]|None="vertical",
41454146
vert:bool|None=None,
41464147
widths:float|ArrayLike=0.5,
41474148
showmeans:bool=False,
@@ -4154,13 +4155,13 @@ 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,
4164+
orientation=orientation,
41644165
vert=vert,
41654166
widths=widths,
41664167
showmeans=showmeans,
@@ -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