-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Plotting: don't change visibility of xaxis labels and ticklabels if passing in a axis #9740
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
Conversation
Ok, seems that there is a place where the plotting code is tested... will redo... |
Ok, fix incoming... rebasing this will be interesting :-( |
ok, updated the code and the tests... Let's see... |
663d47a
to
7243211
Compare
@@ -31,6 +31,14 @@ API changes | |||
|
|||
|
|||
|
|||
- When passing in an ax to `df.plot( ..., ax=ax)`, the `sharex` kwarg will now default to `False`. |
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.
2 backticks instead of 1 to make it render as code
Updated docstrings and fixed whatsnew |
d5fbf4f
to
d183ed1
Compare
self._check_axes_shape(axes, axes_num=3, layout=(3, 1)) | ||
#axes[0].figure.savefig("test.png") |
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.
You can remove this line. And another down on line 3587 and 3602
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.
done
Thanks @JanSchulz. I agree that a user passing in an @sinhrks look good to you? |
This commit fixes two things: 1.) Wrong x label visibility when using gridspec generated axis When using gridspec, plt.gcf().get_axes() was in the wrong order for the code handling setting the right axes label to invisible. Also handle cases where no subplot is in the last row of a column. 2.) Don't change ax label visibility when an axis is passed in Before, when passing in one ax object of a figure with multiple subplots, the plot call would change the visibility of the x labels, so that only the subplots in the last row would have xticklabels and xlabels. This would happen even if the rest of the subplots would not be plotted with pandas. Now, when passing in an ax to `df.plot( ..., ax=ax)`, the `sharex` kwarg will default to `False` and the visibility of xlabels and xticklabels will not anymore be changed. If you still want that, you can either do that by yourself for the right axes in your figure or explicitly set `sharex=True`. Be aware, that this changes the visible for all axes in the figure, not only the one which is passed in! If pandas creates the subplots itself (e.g. no passed in `ax` kwarg), then the default is still `sharex=True` and the visibility changes are applied. Also fix some old unittests which---together with the quirks of `_check_plot_works`, which plots the plot twice, once without an ax kwarg and once with an ax kwarg---triggered test failures as the new behaviour of `ax together without an explicit sharex` would not remove the visibility of some xlabels. Update the docstrings to explain the new sharex behaviour and also add a warning regarding the changing of all subplots' x axis labels, even for subplots which were not created by pandas.
d183ed1
to
015fc62
Compare
Squashed and fixed the above comments |
@JanSchulz @TomAugspurger Looks great! |
Plotting: don't change visibility of xaxis labels and ticklabels if passing in a axis
Ok, thanks all. |
This does two things:
sharex=True
Closes: #9737