@@ -209,10 +209,12 @@ def get_datalim(self, transData):
209
209
210
210
if not transform .is_affine :
211
211
paths = [transform .transform_path_non_affine (p ) for p in paths ]
212
- transform = transform .get_affine ()
212
+ # Don't convert transform to transform.get_affine() here because
213
+ # we may have transform.contains_branch(transData) but not
214
+ # transforms.get_affine().contains_branch(transData). But later,
215
+ # be careful to only apply the affine part that remains.
213
216
if not transOffset .is_affine :
214
217
offsets = transOffset .transform_non_affine (offsets )
215
- transOffset = transOffset .get_affine ()
216
218
217
219
if isinstance (offsets , np .ma .MaskedArray ):
218
220
offsets = offsets .filled (np .nan )
@@ -225,8 +227,8 @@ def get_datalim(self, transData):
225
227
# offset. LineCollections that have no offsets can
226
228
# also use this algorithm (like streamplot).
227
229
result = mpath .get_path_collection_extents (
228
- transform .frozen (), paths , self .get_transforms (),
229
- offsets , transOffset .frozen ())
230
+ transform .get_affine (), paths , self .get_transforms (),
231
+ offsets , transOffset .get_affine (). frozen ())
230
232
return result .inverse_transformed (transData )
231
233
if not self ._offsetsNone :
232
234
# this is for collections that have their paths (shapes)
@@ -235,7 +237,7 @@ def get_datalim(self, transData):
235
237
# those shapes, so we just set the limits based on their
236
238
# location.
237
239
# Finish the transform:
238
- offsets = (transOffset +
240
+ offsets = (transOffset . get_affine () +
239
241
transData .inverted ()).transform (offsets )
240
242
offsets = np .ma .masked_invalid (offsets )
241
243
if not offsets .mask .all ():
0 commit comments