diff --git a/lib/matplotlib/axes/_base.py b/lib/matplotlib/axes/_base.py index 4a3081ed7ec0..c1a55a0ed51a 100644 --- a/lib/matplotlib/axes/_base.py +++ b/lib/matplotlib/axes/_base.py @@ -2403,7 +2403,9 @@ def autoscale_view(self, tight=None, scalex=True, scaley=True): if tight is not None: self._tight = bool(tight) - if self.use_sticky_edges and (self._xmargin or self._ymargin): + if self.use_sticky_edges and ( + (self._xmargin and scalex and self._autoscaleXon) or + (self._ymargin and scaley and self._autoscaleYon)): stickies = [artist.sticky_edges for artist in self.get_children()] x_stickies = sum([sticky.x for sticky in stickies], []) y_stickies = sum([sticky.y for sticky in stickies], [])