@@ -258,9 +258,9 @@ def get_datalim(self, transData):
258
258
259
259
transform = self .get_transform ()
260
260
offset_trf = self .get_offset_transform ()
261
- has_offsets = np . any ( self . _offsets ) # True if any non-zero offsets
262
- if has_offsets and not offset_trf .contains_branch (transData ):
263
- # if there are offsets but in some coords other than data,
261
+ if not ( isinstance ( offset_trf , transforms . IdentityTransform )
262
+ or offset_trf .contains_branch (transData ) ):
263
+ # if the offsets are in some coords other than data,
264
264
# then don't use them for autoscaling.
265
265
return transforms .Bbox .null ()
266
266
offsets = self ._offsets
@@ -289,20 +289,19 @@ def get_datalim(self, transData):
289
289
self .get_transforms (),
290
290
offset_trf .transform_non_affine (offsets ),
291
291
offset_trf .get_affine ().frozen ())
292
- if has_offsets :
293
- # this is for collections that have their paths (shapes)
294
- # in physical, axes-relative, or figure-relative units
295
- # (i.e. like scatter). We can't uniquely set limits based on
296
- # those shapes, so we just set the limits based on their
297
- # location.
298
-
299
- offsets = (offset_trf - transData ).transform (offsets )
300
- # note A-B means A B^{-1}
301
- offsets = np .ma .masked_invalid (offsets )
302
- if not offsets .mask .all ():
303
- bbox = transforms .Bbox .null ()
304
- bbox .update_from_data_xy (offsets )
305
- return bbox
292
+
293
+ # this is for collections that have their paths (shapes)
294
+ # in physical, axes-relative, or figure-relative units
295
+ # (i.e. like scatter). We can't uniquely set limits based on
296
+ # those shapes, so we just set the limits based on their
297
+ # location.
298
+ offsets = (offset_trf - transData ).transform (offsets )
299
+ # note A-B means A B^{-1}
300
+ offsets = np .ma .masked_invalid (offsets )
301
+ if not offsets .mask .all ():
302
+ bbox = transforms .Bbox .null ()
303
+ bbox .update_from_data_xy (offsets )
304
+ return bbox
306
305
return transforms .Bbox .null ()
307
306
308
307
def get_window_extent (self , renderer ):
0 commit comments