-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Updated violin plot example as per suggestions in issue #7251 #7360
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
08db92d
becbfa4
14cd6cf
03946d4
8044e9d
88a8c2e
62c1716
9f4bbdd
b3ce73b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -62,19 +62,15 @@ def set_axis_style(ax, labels): | |
quartile1, medians, quartile3 = np.percentile(data, [25, 50, 75], axis=1) | ||
inter_quartile_ranges = np.vstack([quartile1, quartile3]).T | ||
whiskers = [ | ||
adjacent_values(sorted_array, q1, q3) | ||
adjacent_values(sorted_array, q1, q3) | ||
for sorted_array, q1, q3 in zip(data, quartile1, quartile3)] | ||
|
||
# plot whiskers as thin lines, quartiles as fat lines, | ||
# and medians as points | ||
for i, median in enumerate(medians): | ||
ax2.plot([i + 1, i + 1], whiskers[i], '-', color='black', linewidth=1) | ||
ax2.plot( | ||
[i + 1, i + 1], inter_quartile_ranges[i], '-', color='black', | ||
linewidth=5) | ||
ax2.plot( | ||
i + 1, median, 'o', color='white', | ||
markersize=6, markeredgecolor='none') | ||
whiskersMin, whiskersMax = list(zip(*whiskers)) | ||
# plot medians as points, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can remove these comments, probably There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm right, will remove these comments and the unused variable |
||
# whiskers as thin lines, quartiles as fat lines | ||
inds = np.arange(1, len(medians) + 1) | ||
ax2.scatter(inds, medians, marker='o', color='white', s=30, zorder=3) | ||
ax2.vlines(inds, quartile1, quartile3, color='k', linestyle='-', lw=5) | ||
ax2.vlines(inds, whiskersMin, whiskersMax, color='k', linestyle='-', lw=1) | ||
|
||
# set style for the axes | ||
labels = ['A', 'B', 'C', 'D'] # labels | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. variable name = comment |
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pretty sure this variable is no longer used and so can be removed