Skip to content

Commit

Permalink
add tim's suggestion
Browse files Browse the repository at this point in the history
  • Loading branch information
saranti committed Apr 20, 2024
1 parent d99c8e0 commit 0ea8958
Showing 1 changed file with 13 additions and 19 deletions.
32 changes: 13 additions & 19 deletions lib/matplotlib/axes/_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -8350,10 +8350,10 @@ def matshow(self, Z, **kwargs):

@_api.make_keyword_only("3.9", "vert")
@_preprocess_data(replace_names=["dataset"])
def violinplot(self, dataset, positions=None, vert=None, widths=0.5,
showmeans=False, showextrema=True, showmedians=False,
quantiles=None, points=100, bw_method=None, side='both',
orientation=None):
def violinplot(self, dataset, positions=None, orientation='vertical',
vert=None, widths=0.5, showmeans=False, showextrema=True,
showmedians=False, quantiles=None, points=100,
bw_method=None, side='both',):
"""
Make a violin plot.
Expand Down Expand Up @@ -8475,9 +8475,9 @@ def _kde_method(X, coords):
showmedians=showmedians, side=side)

@_api.make_keyword_only("3.9", "vert")
def violin(self, vpstats, positions=None, vert=None, widths=0.5,
showmeans=False, showextrema=True, showmedians=False, side='both',
orientation=None):
def violin(self, vpstats, positions=None, orientation=None,
vert=None, widths=0.5, showmeans=False, showextrema=True,
showmedians=False, side='both'):
"""
Draw a violin plot from pre-computed statistics.
Expand Down Expand Up @@ -8599,23 +8599,17 @@ def violin(self, vpstats, positions=None, vert=None, widths=0.5,
datashape_message = ("List of violinplot statistics and `{0}` "
"values must have the same length")

# vert and orientation parameters are linked until vert's
# deprecation period expires. If both are selected,
# vert takes precedence.
if vert is not None:
_api.warn_deprecated(
"3.10",
name="vert: bool",
alternative="orientation: {'vertical', 'horizontal'}"
)

# vert and orientation parameters are linked until vert's
# deprecation period expires. If both are selected,
# vert takes precedence.
if vert or vert is None and orientation is None:
orientation = 'vertical'
elif vert is False:
orientation = 'horizontal'

if orientation is not None:
_api.check_in_list(['horizontal', 'vertical'], orientation=orientation)
)
orientation = 'vertical' if vert else 'horizontal'
_api.check_in_list(['horizontal', 'vertical'], orientation=orientation)

# Validate positions
if positions is None:
Expand Down

0 comments on commit 0ea8958

Please sign in to comment.