Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Merged
jklymak merged 1 commit intomatplotlib:masterfromanntzer:pickleshared2
Jul 4, 2018

Conversation

anntzer
Copy link
Contributor

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

  • Has Pytest style unit tests
  • Code is PEP 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

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.
@anntzeranntzer added this to thev3.0 milestoneJul 1, 2018
@timhoffm
Copy link
Member

So, is it correct that now

  1. Pickling and unpickling two shared axes shared axes is now fully transparent?

  2. Having two shared axes A, B and just pickling and unpickling B in the same session breaks the relation because B will have a new grouper?

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?

@anntzer
Copy link
ContributorAuthor

Pickling and unpickling two shared axes shared axes is now fully transparent?

To the best of my knowledge...

Having two shared axes A, B and just pickling and unpickling B in the same session breaks the relation because B will have a new grouper?

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.pickle.loads(pickle.dumps(ax_b))) works, too.

Copy link
Member

@jklymakjklymak left a 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...

@jklymakjklymak merged commitd9d7ff1 intomatplotlib:masterJul 4, 2018
@anntzeranntzer deleted the pickleshared2 branchJuly 4, 2018 18:12
@tacaswell
Copy link
Member

I am glad this ended up being much simpler than I expected.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@jklymakjklymakjklymak approved these changes

@timhoffmtimhoffmtimhoffm approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
v3.0.0
Development

Successfully merging this pull request may close these issues.

4 participants
@anntzer@timhoffm@tacaswell@jklymak

[8]ページ先頭

©2009-2025 Movatter.jp