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

FIX: Handle no-offsets in collection datalim (alternative) #22946

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
timhoffm merged 2 commits into matplotlib:main from greglucas:coll-no-offset2
May 1, 2022

Conversation

Copy link
Contributor

@greglucas greglucas commented Apr 30, 2022

PR Summary

Alternative to #22945

This keeps the None-default case in self._offsets and then transforms to the zeros for default math in the get_offsets() method. This is necessary to handle the (0, 0) offset case that is desired and distinguishing that from the initial empty offset of None. 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
@greglucas greglucas changed the title (削除) Coll no offset2 (削除ここまで) (追記) FIX: Handle no-offsets in collection datalim (alternative) (追記ここまで) Apr 30, 2022
# default to zeros
self._offsets = np.zeros((1, 2))

self._offsets = offsets
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could one move this to after the if-clause? (And more the identical line out of it.)

Copy link
Contributor Author

@greglucas greglucas May 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, good call, updated.

Copy link
Member

@oscargus oscargus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't know there was a get_offset method already. Then I think this is probably a slightly better approach.

This avoids carrying around an extra offsetsNone/has_offsets variable
to keep track of the default case. Instead calling get_offsets() to
return the default zeros case, and then internally checking the
None/default case in get_datalim() which is the only place where this
information is needed.
@timhoffm timhoffm merged commit 7c19d85 into matplotlib:main May 1, 2022
@greglucas greglucas deleted the coll-no-offset2 branch May 1, 2022 13:26
Copy link
Contributor Author

@meeseeksdev backport to v3.5.x

Copy link

lumberbot-app bot commented May 1, 2022

Owee, I'm MrMeeseeks, Look at me.

There seem to be a conflict, please backport manually. Here are approximate instructions:

  1. Checkout backport branch and update it.
git checkout v3.5.x
git pull
  1. Cherry pick the first parent branch of the this PR on top of the older branch:
git cherry-pick -x -m1 7c19d85af973455f8662d91870b1061c5c6e8153
  1. You will likely have some merge/cherry-pick conflict here, fix them and commit:
git commit -am 'Backport PR #22946: FIX: Handle no-offsets in collection datalim (alternative)'
  1. Push to a named branch:
git push YOURFORK v3.5.x:auto-backport-of-pr-22946-on-v3.5.x
  1. Create a PR against branch v3.5.x, I would have named this PR:

"Backport PR #22946 on branch v3.5.x (FIX: Handle no-offsets in collection datalim (alternative))"

And apply the correct labels and milestones.

Congratulations — you did some good work! Hopefully your backport PR will be tested by the continuous integration and merged soon!

Remember to remove the Still Needs Manual Backport label once the PR gets merged.

If these instructions are inaccurate, feel free to suggest an improvement.

greglucas pushed a commit to greglucas/matplotlib that referenced this pull request May 1, 2022
@QuLogic QuLogic modified the milestones: v3.5.3, v3.5.2 May 2, 2022
QuLogic added a commit that referenced this pull request May 2, 2022
...on-v3.5.x
Backport PR #22946: FIX: Handle no-offsets in collection datalim
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers

@timhoffm timhoffm timhoffm approved these changes

@oscargus oscargus oscargus approved these changes

Assignees
No one assigned
Labels
PR: bugfix Pull requests that fix identified bugs topic: collections and mappables
Projects
None yet
Milestone
v3.5.2
Development

Successfully merging this pull request may close these issues.

[Bug]: Regression in animation from #22175

AltStyle によって変換されたページ (->オリジナル) /