-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Fix for shared axes diverging after setting tick markers #10651
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
Also py3fy category.py.
Only exception is axes_grid, whose removal should be accompanied by an update to the docs.
…idspec or subplotspec
lib/matplotlib/axes/_base.py
Outdated
|
||
g = self.get_shared_x_axes() | ||
for ax in g.get_siblings(self): | ||
ax.xaxis.set_ticks(ticks, minor=minor) |
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.
Given how sharing works, I don't think you need all these "set_ticks" lines. I suspect that simply setting 'ax.stale = True' is enough. Would you try that, please?
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.
I just tried it (commenting line 3209). Unfortunately doing that fails the automated test I created, so it wouldn't fix the issue.
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.
Thank you. Still, I'm pretty sure that calling set_ticks is not the right thing to do here. It is breaking part of the sharing connection by giving the axes different instances of the Locators. Instead, it looks like what is needed is synchronization of the view_interval after it was changed in the call to set_ticks. Logically, it seems like sharing should include the viewLim directly, but it doesn't, so when the viewLim is changed, the other axes need to be notified.
Simplify setupext by using globs.
so don't rely on the 3rd party version. Also replace py.test by pytest in the docs (recommended since pytest 3.0, https://docs.pytest.org/en/latest/changelog.html#id281; we require pytest>=3.1 anyways). Also delete tox.ini which is clearly outdated.
Add a link from the examples to the user's guide. Clarify that the weakref behavior only affects *methods* used as callbacks, not free functions.
…strainedlayout FIX/ENH CL: Allow single parent colorbar w/ gridspec layout
Minor fixes to event handling docs.
Currently, Matplotlib reuses axes when add_axes() is called a second time with the same arguments. This behavior is deprecated since 2.1. However we forgot to deprecate the same behavior in gca(), so we can't remove that behavior yet. Also cleanup docstrings of Stack class. Also, process_projection_requirements cannot modify the outer kwargs (because `**kwargs` is always a copy), so remove the incorrect note regarding the need for copies.
Improve Figure docstrings
…stimestamp ENH: check `.values` in more places
…nedlayout PRF: Speed up constrained layout
Matplotlib.nib was used by the old cocoaagg backend (ef8e81e) which has been deleted a while ago.
This is now consistent with the documentation: https://matplotlib.org/users/event_handling.html
figure_enter_event uses now LocationEvent instead of Event. Fix issue matplotlib#9812.
Delete deprecated backends
Anything (approximately) starting with two underscores, or an underscore and a capital letter is reserved in the C++ standard.
Python 3 always uses the new buffer protocol.
It's still not closed, but at least we can reference it later.
Remove Python 2 code from C extensions
More figure-related doc updates
Py3fy font_manager.
Some py3fication for matplotlib/__init__, setupext.
Fixes matplotlib#10501. python3 support and pep8 in jpl_units
Thanks for the feedback @efiring, just a few concerns:
|
Closed this due to the commit history being broken. |
This pull request is updated here: #10691 |
PR Summary
This fixes issue #8946.
It adds code to methods including
set_xticks()
andset_yticks()
, which originally did not immediately update the shared axes. This led to axes having divergingget_xlim()
, producing a wrong plot.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