-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Fix for shared axes diverging after setting tick markers #10691
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
Alright, I've incorporated the feedback given by @efiring. Please let me know what you think. |
lib/matplotlib/axis.py
Outdated
""" | ||
If *ignore* is *False*, the order of vmin, vmax | ||
does not matter; the original axis orientation will | ||
be preserved. In addition, the view limits can be | ||
expanded, but will not be reduced. This method is | ||
expanded, but will not be reduced. |
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.
OK, while we are here, can we make these docstrings numpydoc compliant?
This file has almost no compliant docstrings (apparently it hasn't attracted the attention of @timhoffm, or he already has a PR in that hasn't been merged.)
As a random example of whats needed have a look at:
matplotlib/lib/matplotlib/figure.py
Line 1060 in b6acd04
def add_axes(self, *args, **kwargs): |
If you don't feel like doing this, its probably fine, but it'd help..
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.
Should I make the entire file have compliant docstrings, or just the methods that I changed?
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.
ha ha - go for the whole file if you want, but thats totally unfair. Just the strings you changed 😉
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.
plus, if you think thats too annoying, don't feel obliged. Someone will hit the whole file soon I'm sure...
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.
Did someone call me? 😉
@shaynair No seriously, only update the docstrings as part of this PR if you are touching them anyway. It simplifies the reviews if they are not too large and cover only one aspect. Also, keeping bugfixes and major docstring cleanups separate makes possible backports easier. That said, you are very welcome to open a separate PR for further docstring changes in the file.
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.
Alright, I've updated it in my newest commit.
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.
This looks good to me. I think it needs a whats-new entry because you've added API, though I admit the API is somewhat obscure. Not sure if you need an example that uses the new API. I guess there are times when we don't want the two axes to share ticks, in which case you'd set emit=False
.
This is still a bug in master, but will require some rebasing. Punting to 3.2, but @shaynair keep pushing this if you want it to go in! |
Tried to rebase this, but I'm afraid this is beyond repair. Too much changed in the meantime, so that it would be easier to rewrite from scratch. The test could be recovered to document the problem and be a starting point for a fresh solution. @shaynair I'm very sorry, this got lost and we couldn't bring it into matplotlib. |
Test extracted, adapted and posted into the original issue: #8946 (comment) |
PR Summary
This fixes issue #8946.
A previous pull request #10651 was made, but I erroneously rebased to master which messed up the commit history there.
Example plot:

Associated code snippet to reproduce the above plot:
The two plots should be identical as they share the x-axis, but clearly aren't. This is a fix for this.
PR Checklist