Soft-deprecate transform_point.#14652
Merged
jklymak merged 1 commit intomatplotlib:masterfrom Jul 5, 2019
Merged
Conversation
timhoffm
reviewed
Jun 30, 2019
lib/matplotlib/axis.py
Outdated
| def __str__(self): | ||
| return self.__class__.__name__ \ | ||
| + "(%f,%f)" % tuple(self.axes.transAxes.transform_point((0, 0))) | ||
| return "{} ({},{})".format( |
Member
There was a problem hiding this comment.
Suggested change
| return "{} ({},{})".format( | |
| return "{}({}, {})".format( |
examples/misc/custom_projection.py
Outdated
| transform = self._get_core_transform(1) | ||
| xscale, _ = transform.transform_point((np.pi, 0)) | ||
| _, yscale = transform.transform_point((0, np.pi / 2.0)) | ||
| (xscale, _), (_, yscale) = transform.transform( |
Member
There was a problem hiding this comment.
Not sure if this change is worth it. Probably slightly faster but less readable.
The transform() method has explicit code to handle 1d input, so transform_point() is redundant with transform() (... and is anyways implemented in terms of transform(), so not faster either)... and longer to type. Replace it throughout the codebase. Also compress consecutive calls to transform_point() with a single call to transform(), which may be a bit faster (one matrix multiplication instead of two); also a single replacement to use transform_bbox as appropriate. Only "deprecate" transform_point in the docs because I don't really want to discuss here whether this would be too disruptive...
timhoffm
approved these changes
Jun 30, 2019
jklymak
approved these changes
Jul 5, 2019
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.
The transform() method has explicit code to handle 1d input, so
transform_point() is redundant with transform() (... and is anyways
implemented in terms of transform(), so not faster either)... and longer
to type.
Replace it throughout the codebase. Also compress consecutive calls
to transform_point() with a single call to transform(), which may be a
bit faster (one matrix multiplication instead of two); also a single
replacement to use transform_bbox as appropriate.
Only "deprecate" transform_point in the docs because I don't really want
to discuss here whether this would be too disruptive...
PR Summary
PR Checklist