We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 529d37c commit defd13eCopy full SHA for defd13e
1 file changed
lib/matplotlib/axes/_base.py
@@ -2416,6 +2416,12 @@ def _update_image_limits(self, image):
2416
xmin, xmax, ymin, ymax = image.get_extent()
2417
self.axes.update_datalim(((xmin, ymin), (xmax, ymax)))
2418
2419
+ def _update_collection_limits(self, collection):
2420
+ offsets = collection.get_offsets()
2421
+ if offsets is not None and len(offsets):
2422
+ self.update_datalim(offsets)
2423
+
2424
2425
def add_line(self, line):
2426
"""
2427
Add a `.Line2D` to the Axes; return the line.
@@ -2607,9 +2613,7 @@ def relim(self, visible_only=False):
2607
2613
elif isinstance(artist, mimage.AxesImage):
2608
2614
self._update_image_limits(artist)
2609
2615
elif isinstance(artist, mcollections.Collection):
2610
- offsets = artist.get_offsets()
2611
- if offsets is not None and len(offsets):
2612
- self.update_datalim(offsets)
2616
+ self._update_collection_limits(artist)
2617
2618
def update_datalim(self, xys, updatex=True, updatey=True):
2619
0 commit comments