Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1d8b229

Browse files
committed
BUG: Add explanatory comments to relim() Collection branch
Mirror the comments from add_collection() that explain why minpos is included (log scale support) and why contains_branch_separately is used to conditionally update x/y limits.
1 parent 07127b6 commit 1d8b229

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

lib/matplotlib/axes/_base.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2662,8 +2662,13 @@ def relim(self, visible_only=False):
26622662
datalim = artist.get_datalim(self.transData)
26632663
points = datalim.get_points()
26642664
if not np.isinf(datalim.minpos).all():
2665+
# As in add_collection: include minpos so that
2666+
# self.dataLim updates its own minpos, which ensures
2667+
# log scales see the correct minimum.
26652668
points = np.concatenate([points,
26662669
[datalim.minpos]])
2670+
# Only update dataLim for x/y if the collection uses
2671+
# transData in that direction.
26672672
x_is_data, y_is_data = (
26682673
artist.get_transform()
26692674
.contains_branch_separately(self.transData))

0 commit comments

Comments
 (0)