Propagate minpos from Collections to Axes.datalim#18642
Merged
jklymak merged 5 commits intomatplotlib:masterfrom Jan 5, 2021
Merged
Propagate minpos from Collections to Axes.datalim#18642jklymak merged 5 commits intomatplotlib:masterfrom
jklymak merged 5 commits intomatplotlib:masterfrom
Conversation
jklymak
reviewed
Oct 3, 2020
Member
jklymak
left a comment
There was a problem hiding this comment.
this looks correct, but I'd need to spend more time with it to completely follow it. Can you add comments? Otherwise its pretty mysterious...
| # also use this algorithm (like streamplot). | ||
| result = mpath.get_path_collection_extents( | ||
| transform.get_affine(), paths, self.get_transforms(), | ||
| return mpath.get_path_collection_extents( |
Member
There was a problem hiding this comment.
again, this could get some more explanation, given that there is a comment above, but this is clearly different. I'm not even sure I understand why you can change this like this.
Member
Author
There was a problem hiding this comment.
The first argument is the master transform; instead of doing one transform when finding extents, and a second one after on the result, this does a combined transform from the get-go. This ensures that whatever is calculated for minpos is in the final coordinate space.
b6d26c8 to
364d4a4
Compare
tacaswell
reviewed
Oct 9, 2020
tacaswell
approved these changes
Oct 9, 2020
364d4a4 to
d834b01
Compare
jklymak
reviewed
Oct 10, 2020
This is already calculated by the internal C++ code, but discarded at the end of the Python function.
This ensures that autoscaling on log scales is correct.
This test is a distilled out of matplotlib#16552.
This is mostly for the sake of third-party `Collection` subclasses that might have overridden `get_datalim`.
d834b01 to
e85ea1b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Summary
This is an attempt to fix #16552. I'm not sure if it's the best change, API-wise, but seems to work without breaking anything. Possibly could do with an API change note.
Essentially, we have the right information to do log auto-scaling correct, but that's thrown away at the
Collection.get_datalim/Axes.add_collectioninterface. This propagates that information onto theBboxthat's passed between those two functions, and uses it when updatingAxes.dataLim.PR Checklist
pytestpasses).flake8on changed files to check).flake8-docstringsandpydocstyle<4and runflake8 --docstring-convention=all).doc/users/next_whats_new/(follow instructions in README.rst there).doc/api/next_api_changes/(follow instructions in README.rst there).