-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
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: df.boxplot fails to use existing axis/subplot (#3578) #6991
Conversation
@onesandzeroes can you rehash and force push to run travis ci again? thx here's a line to do just that git commit --amend -C HEAD && git push --force |
Alright, I've just pushed it up now. I have a feeling that this might overlap with the new #7035 pull request, which is fixing a pretty closely related issue, so if that gets merged first I might have to go back over and check this one. |
Sorry, was I supposed to rebase as well? The build still seems to be failing for unrelated reasons (reading finance data from Yahoo), is this likely to be fixed if I rebase on master? |
I've rebased on master and the tests seem to be passing now. |
@onesandzeroes if you can squash would be great, see https://github.com/pydata/pandas/wiki/Using-Git |
Could you add a test for when import itertools
fig, ax = plt.subplots()
d = df.boxplot(ax=ax)
lines = list(chain.from_iterable(d.values()))
self.assertEqual(len(ax.get_lines()), len(lines)) |
sharex=True, sharey=True, | ||
figsize=figsize, ax=ax) | ||
else: | ||
if ngroups > 1: |
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.
We could handle this case, assuming that ax
is an array with size equal to ngroups
. Want to open a separate issue for that?
This is out of scope for this issue, but do we have a specified way for when a plot call with None for Just that one additional test for when |
Added the new test, rebased and squashed it down to a single commit, so it should be good to go. I've also created a new issue for allowing multiple axes in the |
axes needs to be a plt.Axes object use ax get_axes() to set axes Add tests for use of existing axis Add test for when by is None Add fix to the release notes
Merged via f851b57 Thanks! |
Alright, I think I have a fix for issue #3578. In
plotting._grouped_plot_by_column
, there was no check being done for whetherax
wasNone
, which was the main source of the issue. When the boxplot is of multiple columns, I don't think there's anything sensible that can be done with theax
argument, so thatnow raises a
ValueError
.I've written some tests, but I'm not sure if they really get to the heart of the problem, so any insight on how to improve them would be appreciated.
Testing code adapted from the original bug report to demonstrate the new behaviour: