Skip to content

Commit 364d4a4

Browse files
committed
Only propagate minpos if it's been set.
This is mostly for the sake of third-party `Collection` subclasses that might have overridden `get_datalim`.
1 parent a73c862 commit 364d4a4

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

lib/matplotlib/axes/_base.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1989,12 +1989,14 @@ def add_collection(self, collection, autolim=True):
19891989
# pre-lazy-autoscale behavior, which is not really better).
19901990
self._unstale_viewLim()
19911991
datalim = collection.get_datalim(self.transData)
1992-
# By definition, p0 <= minpos <= p1, so minpos would be
1993-
# unnecessary. However, we add minpos to the call so that
1994-
# self.dataLim will update its own minpos. This ensures that log
1995-
# scales see the correct minimum.
1996-
self.update_datalim(
1997-
np.row_stack([datalim.p0, datalim.minpos, datalim.p1]))
1992+
points = datalim.get_points()
1993+
if not np.isinf(datalim.minpos).all():
1994+
# By definition, p0 <= minpos <= p1, so minpos would be
1995+
# unnecessary. However, we add minpos to the call so that
1996+
# self.dataLim will update its own minpos. This ensures that
1997+
# log scales see the correct minimum.
1998+
points = np.concatenate([points, [datalim.minpos]])
1999+
self.update_datalim(points)
19982000

19992001
self.stale = True
20002002
return collection

0 commit comments

Comments
 (0)