-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
External transform api #1090
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
External transform api #1090
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,8 @@ | |
import matplotlib | ||
import matplotlib.cbook as cbook | ||
from matplotlib import docstring, rcParams | ||
from transforms import Bbox, IdentityTransform, TransformedBbox, TransformedPath | ||
from transforms import Bbox, IdentityTransform, TransformedBbox, \ | ||
TransformedPath, Transform | ||
from path import Path | ||
|
||
## Note, matplotlib artists use the doc strings for set and get | ||
|
@@ -223,7 +224,7 @@ def set_transform(self, t): | |
ACCEPTS: :class:`~matplotlib.transforms.Transform` instance | ||
""" | ||
self._transform = t | ||
self._transformSet = True | ||
self._transformSet = t is not None | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Turns out this is bad. Reverted in #1176 (along with a suitable test). |
||
self.pchanged() | ||
|
||
def get_transform(self): | ||
|
@@ -233,6 +234,9 @@ def get_transform(self): | |
""" | ||
if self._transform is None: | ||
self._transform = IdentityTransform() | ||
elif (not isinstance(self._transform, Transform) | ||
and hasattr(self._transform, '_as_mpl_transform')): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there any point in checking for the _as_mpl_transform attribute? If it is not None, and it is not a Transform, and it can't be made into one, shouldn't it just raise an exception? Or is the idea that something not inheriting from Transform can still function as if it did? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The idea was simply to not break anything else that was already passing something fruity. I think it might just get down to the point where the I'm not too fussed either way, but I am happy to be less generous and just try calling the |
||
self._transform = self._transform._as_mpl_transform(self.axes) | ||
return self._transform | ||
|
||
def hitlist(self, event): | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For later cleanup, at leisure: use parentheses instead of backslash; I'm pretty sure this is supported for 2.6 and later.