Skip to content

FIX: Handle no-offsets in collection datalim #22945

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 1 commit into from
May 1, 2022

Conversation

greglucas
Copy link
Contributor

PR Summary

This adds a check for whether the collection has offsets
passed in initially. This is necessary to handle the (0, 0) offset
case that is desired and distinguishing that from the initial empty
offset of (0, 0). In particular, this is necessary for the
non-transData IdentityTransform passed in during tight_layout calculations.

closes #22921

PR Checklist

Tests and Styling

  • Has pytest style unit tests (and pytest passes).
  • Is Flake 8 compliant (install flake8-docstrings and run flake8 --docstring-convention=all).

Documentation

  • [N/A] New features are documented, with examples if plot related.
  • [N/A] New features have an entry in doc/users/next_whats_new/ (follow instructions in README.rst there).
  • [N/A] API changes documented in doc/api/next_api_changes/ (follow instructions in README.rst there).
  • [N/A] Documentation is sphinx and numpydoc compliant (the docs should build without error).

This adds a check for whether the collection has offsets
passed in initially. This is necessary to handle the (0, 0) offset
case that is desired and distinguishing that from the initial empty
offset of (0, 0). In particular, this is necessary for the
non-transData IdentityTransform passed in during tight_layout calculations.
@greglucas greglucas added topic: collections and mappables PR: bugfix Pull requests that fix identified bugs labels Apr 30, 2022
@greglucas greglucas added this to the v3.5.3 milestone Apr 30, 2022
@timhoffm
Copy link
Member

Is the extra variable really necessary? One could internally keep _offsets = None. The advantage is that the logical information ( no offset | zero offset | finite offset ) is kept in one variable. But I didn't look into the code maybe it's overly complicated to handle None everywhere in the code.

@oscargus
Copy link
Member

overly complicated to handle None

The solution to this may be to introduce a _get_offset method that returns the "default" if self._offset == None and a _has_offset method which checks self._offset. While this may in some sense be cleaner, I am not sure it will provide much of a benefit in practice though, probably the opposite, having to recreate static information and not reducing the number of class members.

@greglucas
Copy link
Contributor Author

See #22946 for an alternative to this. I don't have a strong preference either way.

@timhoffm timhoffm merged commit de4a94c into matplotlib:main May 1, 2022
@greglucas greglucas deleted the coll-no-offset branch May 1, 2022 13:24
@QuLogic
Copy link
Member

QuLogic commented May 2, 2022

I'm confused; both of these are merged?

@greglucas
Copy link
Contributor Author

I was too, but I didn't see multiple commits in main. I think that what happened is GitHub saw that this commit hash was added to main as a part of the other PR (I branched off of this to keep the test) and then said that this was merged already, so updated the notice here. Maybe @timhoffm did manually merge both though?

@QuLogic
Copy link
Member

QuLogic commented May 2, 2022

Oh, I didn't notice there were two commits in the other. Yea, GitHub will mark this merged since that commit is now in main.

@QuLogic QuLogic modified the milestones: v3.5.3, v3.5.2 May 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: bugfix Pull requests that fix identified bugs topic: collections and mappables
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Regression in animation from #22175
4 participants