Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0ea8958

Browse files
committed
add tim's suggestion
1 parent d99c8e0 commit 0ea8958

File tree

1 file changed

+13
-19
lines changed

1 file changed

+13
-19
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 13 additions & 19 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-
def violinplot(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+
def violinplot(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
@@ -8475,9 +8475,9 @@ def _kde_method(X, coords):
84758475
showmedians=showmedians, side=side)
84768476

84778477
@_api.make_keyword_only("3.9", "vert")
8478-
def violin(self, vpstats, positions=None, vert=None, widths=0.5,
8479-
showmeans=False, showextrema=True, showmedians=False, side='both',
8480-
orientation=None):
8478+
def violin(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
@@ -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
if vert is not None:
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-
if vert or vert is None and orientation is None:
8613-
orientation = 'vertical'
8614-
elif vert is False:
8615-
orientation = 'horizontal'
8616-
8617-
if orientation is not None:
8618-
_api.check_in_list(['horizontal', 'vertical'], orientation=orientation)
8610+
)
8611+
orientation = 'vertical' if vert else 'horizontal'
8612+
_api.check_in_list(['horizontal', 'vertical'], orientation=orientation)
86198613

86208614
# Validate positions
86218615
if positions is None:

0 commit comments

Comments
 (0)