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

Skip to content

Commit 537a209

Browse files
Skip most children for sticky edge checks
1 parent a56570e commit 537a209

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

lib/matplotlib/axes/_base.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3016,10 +3016,14 @@ def autoscale_view(self, tight=None, scalex=True, scaley=True):
30163016

30173017
x_stickies = y_stickies = np.array([])
30183018
if self.use_sticky_edges:
3019+
# Use ._children and ._sticky_edges directly, because most extra
3020+
# artists in .get_children() (spines, titles, etc.) never have
3021+
# sticky edges. We also check axis objects since they can have
3022+
# sticky edges (e.g. polar RadialAxis).
30193023
if self._xmargin and scalex and self.get_autoscalex_on():
30203024
x_sticky_lists = []
30213025
for ax in x_shared:
3022-
for artist in ax.get_children():
3026+
for artist in (*ax._children, *ax._axis_map.values()):
30233027
sticky_edges = artist._sticky_edges
30243028
if sticky_edges is not None and sticky_edges.x:
30253029
x_sticky_lists.append(sticky_edges.x)
@@ -3028,7 +3032,7 @@ def autoscale_view(self, tight=None, scalex=True, scaley=True):
30283032
if self._ymargin and scaley and self.get_autoscaley_on():
30293033
y_sticky_lists = []
30303034
for ax in y_shared:
3031-
for artist in ax.get_children():
3035+
for artist in (*ax._children, *ax._axis_map.values()):
30323036
sticky_edges = artist._sticky_edges
30333037
if sticky_edges is not None and sticky_edges.y:
30343038
y_sticky_lists.append(sticky_edges.y)

0 commit comments

Comments
 (0)