@@ -268,8 +268,8 @@ def get_datalim(self, transData):
268268
269269 transform = self .get_transform ()
270270 transOffset = self .get_offset_transform ()
271- hasOffsets = np . any ( self . _offsets ) # True if any non-zero offsets
272- if hasOffsets and not transOffset .contains_branch (transData ):
271+ if not ( isinstance ( transOffset , transforms . IdentityTransform )
272+ or transOffset .contains_branch (transData ) ):
273273 # if there are offsets but in some coords other than data,
274274 # then don't use them for autoscaling.
275275 return transforms .Bbox .null ()
@@ -299,20 +299,20 @@ def get_datalim(self, transData):
299299 self .get_transforms (),
300300 transOffset .transform_non_affine (offsets ),
301301 transOffset .get_affine ().frozen ())
302- if hasOffsets :
303- # this is for collections that have their paths (shapes)
304- # in physical, axes-relative, or figure-relative units
305- # (i.e. like scatter). We can't uniquely set limits based on
306- # those shapes, so we just set the limits based on their
307- # location.
308-
309- offsets = (transOffset - transData ).transform (offsets )
310- # note A-B means A B^{-1}
311- offsets = np .ma .masked_invalid (offsets )
312- if not offsets .mask .all ():
313- bbox = transforms .Bbox .null ()
314- bbox .update_from_data_xy (offsets )
315- return bbox
302+
303+ # this is for collections that have their paths (shapes)
304+ # in physical, axes-relative, or figure-relative units
305+ # (i.e. like scatter). We can't uniquely set limits based on
306+ # those shapes, so we just set the limits based on their
307+ # location.
308+
309+ offsets = (transOffset - transData ).transform (offsets )
310+ # note A-B means A B^{-1}
311+ offsets = np .ma .masked_invalid (offsets )
312+ if not offsets .mask .all ():
313+ bbox = transforms .Bbox .null ()
314+ bbox .update_from_data_xy (offsets )
315+ return bbox
316316 return transforms .Bbox .null ()
317317
318318 def get_window_extent (self , renderer ):
0 commit comments