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

Skip to content

Commit f188cd8

Browse files
Skip most children for sticky edge checks
1 parent 874fe77 commit f188cd8

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
@@ -3032,10 +3032,14 @@ def autoscale_view(self, tight=None, scalex=True, scaley=True):
30323032

30333033
x_stickies = y_stickies = np.array([])
30343034
if self.use_sticky_edges:
3035+
# Use ._children and ._sticky_edges directly, because most extra
3036+
# artists in .get_children() (spines, titles, etc.) never have
3037+
# sticky edges. We also check axis objects since they can have
3038+
# sticky edges (e.g. polar RadialAxis).
30353039
if self._xmargin and scalex and self.get_autoscalex_on():
30363040
x_sticky_lists = []
30373041
for ax in x_shared:
3038-
for artist in ax.get_children():
3042+
for artist in (*ax._children, *ax._axis_map.values()):
30393043
sticky_edges = artist._sticky_edges
30403044
if sticky_edges is not None and sticky_edges.x:
30413045
x_sticky_lists.append(sticky_edges.x)
@@ -3044,7 +3048,7 @@ def autoscale_view(self, tight=None, scalex=True, scaley=True):
30443048
if self._ymargin and scaley and self.get_autoscaley_on():
30453049
y_sticky_lists = []
30463050
for ax in y_shared:
3047-
for artist in ax.get_children():
3051+
for artist in (*ax._children, *ax._axis_map.values()):
30483052
sticky_edges = artist._sticky_edges
30493053
if sticky_edges is not None and sticky_edges.y:
30503054
y_sticky_lists.append(sticky_edges.y)

0 commit comments

Comments
 (0)