Skip to content

Commit f4071c8

Browse files
committed
PRF: Disable sticky edge search if not autoscaling.
If there's not margin to be added, we don't need sticky edges, but if autoscaling is off, we _also_ don't need the sticky edges. This saves a lot of time when plotting many artists, like in matplotlib#12542.
1 parent 97a580c commit f4071c8

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎lib/matplotlib/axes/_base.py‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2403,7 +2403,9 @@ def autoscale_view(self, tight=None, scalex=True, scaley=True):
24032403
if tight is not None:
24042404
self._tight = bool(tight)
24052405

2406-
if self.use_sticky_edges and (self._xmargin or self._ymargin):
2406+
if self.use_sticky_edges and (
2407+
(self._xmargin and scalex and self._autoscaleXon) or
2408+
(self._ymargin and scaley and self._autoscaleYon)):
24072409
stickies = [artist.sticky_edges for artist in self.get_children()]
24082410
x_stickies = sum([sticky.x for sticky in stickies], [])
24092411
y_stickies = sum([sticky.y for sticky in stickies], [])

0 commit comments

Comments
 (0)