@@ -213,8 +213,6 @@ def get_datalim(self, transData):
213
213
# we may have transform.contains_branch(transData) but not
214
214
# transforms.get_affine().contains_branch(transData). But later,
215
215
# be careful to only apply the affine part that remains.
216
- if not transOffset .is_affine :
217
- offsets = transOffset .transform_non_affine (offsets )
218
216
219
217
if isinstance (offsets , np .ma .MaskedArray ):
220
218
offsets = offsets .filled (np .nan )
@@ -228,17 +226,18 @@ def get_datalim(self, transData):
228
226
# also use this algorithm (like streamplot).
229
227
result = mpath .get_path_collection_extents (
230
228
transform .get_affine (), paths , self .get_transforms (),
231
- offsets , transOffset .get_affine ().frozen ())
232
- return result .inverse_transformed (transData )
229
+ transOffset .transform_non_affine (offsets ),
230
+ transOffset .get_affine ().frozen ())
231
+ return result .transformed (transData .inverted ())
233
232
if not self ._offsetsNone :
234
233
# this is for collections that have their paths (shapes)
235
234
# in physical, axes-relative, or figure-relative units
236
235
# (i.e. like scatter). We can't uniquely set limits based on
237
236
# those shapes, so we just set the limits based on their
238
237
# location.
239
- # Finish the transform:
240
- offsets = (transOffset . get_affine () +
241
- transData . inverted ()). transform ( offsets )
238
+
239
+ offsets = (transOffset - transData ). transform ( offsets )
240
+ # note A-B means A B^{-1}
242
241
offsets = np .ma .masked_invalid (offsets )
243
242
if not offsets .mask .all ():
244
243
points = np .row_stack ((offsets .min (axis = 0 ),
0 commit comments