Repository navigation
Adds option to plot average in boxplot, besides the median - #2520
miggaiowski wants to merge 6 commits into
Conversation
There was a problem hiding this comment.
being pedantic about reverse compatibility, I think you should add these after hold=None so anyone using all of the positional arguments won't be surprised
There was a problem hiding this comment.
I suspect that the travis failure is coming from this line, can you re-arrange this so it is < 80chr per line?
There was a problem hiding this comment.
Right, just fixed it. Thanks
There was a problem hiding this comment.
This is a minor point, but would it make more sense to re-arrange this logic so that the average is only computed if needed?
There was a problem hiding this comment.
Sounds good, diff on the way.
On Tue, Oct 15, 2013 at 12:25 PM, Thomas A Caswell <notifications@github.com
wrote:
In lib/matplotlib/axes/_axes.py:
@@ -2996,6 +3024,15 @@ def computeConfInterval(data, med, iq, bootstrap):
if usermedians[i] is not None:
med = usermedians[i]
if averages:# get averageavg = np.average(d)
# replace with input averages if availableif useraverages is not None:if useraverages[i] is not None:avg = useraverages[i]
This is a minor point, but would it make more sense to re-arrange this
logic so that the average is only computed if needed?—
Reply to this email directly or view it on GitHubhttps://github.com//pull/2520/files#r6974227
.
Miguel Gaiowski
There was a problem hiding this comment.
pep8 is going to complain about this white space
|
Is there anything else I need to do? |
|
Looks good, though I'd like to see an existing test updated to include this functionality. |
|
I tried writing another boxplot test at I could just add another test function like this: @image_comparison(baseline_images=['boxplot_with_averages'],
extensions=['pdf', 'png'])
def test_boxplot_with_averages():
x = np.linspace(-7, 7, 140)
x = np.hstack([-25, x, 25])
fig = plt.figure()
ax = fig.add_subplot(111)
# show 1 boxplot with mpl medians/conf. intervals, 1 with manual values
ax.boxplot([x, x], bootstrap=10000, usermedians=[None, 1.0],
conf_intervals=[None, (-1.0, 3.5)], averages=True)
ax.set_ylim((-30, 30))But first I'd need help figuring out how to run this test and get the previous test to pass. |
|
@miggaiowski What OS are you using? |
|
Mac OS X. Miguel Gaiowski
|
|
It's been a while, can we get this in without the tests? I've been using it just fine, along with a colleague. |
|
It no longer merges cleanly so it will need a re-base. The unit-tests are not because we don't believe it doesn't work now, but so that in the future a seemingly unrelated changes does not break it. |
|
I think this is a good addition. If you and core team can hold off, over the US Thanksgiving holiday, I plan to submit a PR that will split the The idea here is that The main advantage here is that there are a ton of different ways to render a boxplot[1] and the API is getting pretty bloated. [1] e.g., I have 1 project manager who insists on putting the caps at the 5th and 95th percentiles, and another at the max and min First pass at list of keys that will be in that dictionary:
Another advantage to this approach is that the |
|
Sounds good! Thanks! |
|
Should I close this or leave it open? =) |
|
@miggaiowski Is there anything is this PR that is not include in #2643? |
|
I think it has everything. On Sun, Jan 5, 2014 at 3:07 PM, Thomas A Caswell
Miguel Gaiowski |
|
ok, then I am going to close this PR. |
I wrote this as I needed it and matplotlib didn't support it.
Please let me know if it looks good or if anything needs improvement.
I've attached an example of how it looks.
