-
-
Notifications
You must be signed in to change notification settings - Fork 18.7k
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fix sharex/sharey behaviour together with passing in an axis
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.
- Loading branch information
commit 015fc62dad34e1293728f4ae0cf438f798f5f1de
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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