Skip to content

Commit c088477

Browse files
Phil Elsonpelson
Phil Elson
authored andcommitted
Fixed broken handling of WrappedTransform
1 parent 4c88a6d commit c088477

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

lib/matplotlib/transforms.py

+9-5
Original file line numberDiff line numberDiff line change
@@ -1293,11 +1293,11 @@ def _set(self, child):
12931293
self.transform_path_non_affine = child.transform_path_non_affine
12941294
self.get_affine = child.get_affine
12951295
self.inverted = child.inverted
1296-
self.is_affine = child.is_affine
12971296
self.get_matrix = child.get_matrix
12981297

1299-
def __eq__(self, other):
1300-
return self._child == other
1298+
# note we do not wrap other properties here since the transform's
1299+
# child can be changed with WrappedTransform.set and so checking
1300+
# is_affine and other such properties may be dangerous.
13011301

13021302
def set(self, child):
13031303
"""
@@ -2044,9 +2044,13 @@ def composite_transform_factory(a, b):
20442044
20452045
c = a + b
20462046
"""
2047-
if a == IdentityTransform():
2047+
# check to see if any of a or b are IdentityTransforms. Note we
2048+
# do not use equality here since we may have wrapped transforms
2049+
# which are currently equal to Identity, but since wrapped transforms
2050+
# are mutable, they may not always be equal.
2051+
if isinstance(a, IdentityTransform):
20482052
return b
2049-
elif b == IdentityTransform():
2053+
elif isinstance(b, IdentityTransform):
20502054
return a
20512055
elif a.is_affine and b.is_affine:
20522056
return CompositeAffine2D(a, b)

0 commit comments

Comments
 (0)