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

Skip to content

Commit ad0bcd4

Browse files
committed
Fixed an issue in violinplot where the top end of violins would be truncated.
Updated test images and reran boilerplate.py
1 parent f189325 commit ad0bcd4

File tree

83 files changed

+17970
-18953
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+17970
-18953
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6735,7 +6735,7 @@ def violinplot(self, dataset, positions=None, vert=True, widths=0.5,
67356735
67366736
violinplot(dataset, positions=None, vert=True, widths=0.5,
67376737
showmeans=False, showextrema=True, showmedians=False,
6738-
points=100):
6738+
points=100, bw_method=None):
67396739
67406740
Make a violin plot for each column of *dataset* or each vector in
67416741
sequence *dataset*. Each filled area extends to represent the
@@ -6864,7 +6864,7 @@ def violinplot(self, dataset, positions=None, vert=True, widths=0.5,
68646864
max_val = kde.dataset.max()
68656865
mean = np.mean(kde.dataset)
68666866
median = np.median(kde.dataset)
6867-
coords = np.arange(min_val, max_val, (max_val - min_val)/points)
6867+
coords = np.linspace(min_val, max_val, points)
68686868

68696869
vals = kde.evaluate(coords)
68706870

lib/matplotlib/pyplot.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3400,7 +3400,8 @@ def triplot(*args, **kwargs):
34003400
# changes will be lost
34013401
@_autogen_docstring(Axes.violinplot)
34023402
def violinplot(dataset, positions=None, vert=True, widths=0.5, showmeans=False,
3403-
showextrema=True, showmedians=False, points=100, hold=None):
3403+
showextrema=True, showmedians=False, points=100, bw_method=None,
3404+
hold=None):
34043405
ax = gca()
34053406
# allow callers to override the hold state by passing hold=True|False
34063407
washold = ax.ishold()
@@ -3411,7 +3412,7 @@ def violinplot(dataset, positions=None, vert=True, widths=0.5, showmeans=False,
34113412
ret = ax.violinplot(dataset, positions=positions, vert=vert,
34123413
widths=widths, showmeans=showmeans,
34133414
showextrema=showextrema, showmedians=showmedians,
3414-
points=points)
3415+
points=points, bw_method=bw_method)
34153416
draw_if_interactive()
34163417
finally:
34173418
ax.hold(washold)
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)