Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Restore axes sharedness when unpickling.#11544
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Previously, pickling and unpickling shared axes would result inaxes sharing a ticker instance (because that's how shared axesare set up), but without changes of one's xlims propagated to theother. The reason is that that sharedness information is stored inAxesBase._shared_x_axes, which does *not* get pickled together with theAxes instance: the latter only has a textual reference "I am an instanceof AxesBase", so the Grouper information is lost.To keep the Grouper information valid, additionally pickle the currentgroup of shared axes together with the Axes, and restore thatinformation upon unpickling.
So, is it correct that now
Would be good enough for me. Do we have some place to document that you would always have to pickle the full set of shared axes together? |
To the best of my knowledge...
No, because there is a single grouper instance, unpickling B just readds its connected component to it (which is already there and doesn't change anything). Manually trying that (e.g. |
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 think this is right...
I am glad this ended up being much simpler than I expected. |
Alternative implementation of#10659, which addresses the issues raised in the comments.
Previously, pickling and unpickling shared axes would result in
axes sharing a ticker instance (because that's how shared axes
are set up), but without changes of one's xlims propagated to the
other. The reason is that that sharedness information is stored in
AxesBase._shared_x_axes, which doesnot get pickled together with the
Axes instance: the latter only has a textual reference "I am an instance
of AxesBase", so the Grouper information is lost.
this is the part of the implementation that changed
To keep the Grouper information valid, additionally pickle the current
group of shared axes together with the Axes, and restore that
information upon unpickling.
end of diff
PR Summary
PR Checklist