-
-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
BUG: Boxplot to return axes, not dict #4472
Conversation
is this consistent with #4020 (I believe that's the point here!) |
|
@@ -1068,7 +1067,7 @@ def assert_is_valid_plot_return_object(objs): | |||
'type encountered {0!r}' | |||
''.format(el.__class__.__name__)) | |||
else: | |||
assert isinstance(objs, (plt.Artist, tuple, dict)), \ | |||
assert isinstance(objs, plt.Axes), \ |
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.
@phobson This should be kept as plt.Artist
since not all plotting functions return Axes
instances.
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.
@phobson Can you remove the dict
check here, since boxplot
was the only function returning a dict
?
@cpcloud can u take a look |
Looks okay to me, modulo what I said in the outdated diff. @jreback Do you think it's worth noting in the docs how to recreate the |
@cpcloud def formatBoxplot(bp, color='b', marker='o', linestyle='-'):
# format the box itself
for box in bp['boxes']:
plt.setp(box, color='k', linewidth=0.75, zorder=4)
# format the medians
for med in bp['medians']:
plt.setp(med, linewidth=1.00, color=color, linestyle=linestyle, zorder=2)
# format the whiskers
for whi in bp['whiskers']:
plt.setp(whi, linestyle='-', color='k', linewidth=0.75, zorder=4)
# format the caps on top of the whiskers
for cap in bp['caps']:
plt.setp(cap, linewidth=0.75, zorder=4)
# format the outliers
for fli in bp['fliers']:
plt.setp(fli, marker=marker, markersize=4, zorder=4,
markerfacecolor='none', markeredgecolor=color) Any thoughts on returning both the |
@phobson I was thinking something similar after glancing at the matplotlib source, sigh. I'm not sure there's a point to return both the axes and the dict since you can get the axes easily with |
now that i think about it, i think both is an okay compromise |
Since Travis is failing and I'm not at a machine where I can easily build this, I'll have to pick this up again later. |
@phobson ping! |
Get folks. Sorry for the delay. When started poking around the source and tests, this was a lite more complicated than I anticipated. I hope to get to this soon. (Maybe tonight, or by the end of the week.) Paul Hobson On Wed, Sep 25, 2013 at 4:59 PM, jreback notifications@github.com wrote:
|
The documentation seems to suggest that pandas.DataFrame.boxplot already returns a matplotlib.axes.AxesSubplot object -- but I don't believe this to be the case? Perhaps the documentation could be updated to indicate that boxplot() currently returns a dict? |
@seclinch - it'd be great if you could submit a pull request with the docs change. (which we'll revert once this current pull request is merged) |
@phobson can you rebase this |
what do you think? |
@phobson can you add a doc saying how to get the dict back? Then I think good to go. |
does this fix #4636 as well? |
I don't think this is ready yet. I'll have some bandwidth on friday to look On Wed, Apr 9, 2014 at 5:56 AM, jreback notifications@github.com wrote:
|
Let us know if we can help. |
There's a hacky plot testing function that special cases checking the return value type of boxplot. You'll have to remove the lines that check for a dict and then the tests should pass. |
@phobson status on this? |
@phobson ok....going to do this for 0.14. |
See @jseabold's comment here #4264 (comment) I agree that box plot should always return an axes (array of axes if subplots). An optional kwarg |
superseded by #7096 |
Fixes #4264.