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

Skip to content

Commit 02078f0

Browse files
Faster autoscale_view
1 parent 46c9ceb commit 02078f0

1 file changed

Lines changed: 10 additions & 8 deletions

File tree

lib/matplotlib/axes/_base.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3014,15 +3014,17 @@ def autoscale_view(self, tight=None, scalex=True, scaley=True):
30143014
x_stickies = y_stickies = np.array([])
30153015
if self.use_sticky_edges:
30163016
if self._xmargin and scalex and self.get_autoscalex_on():
3017-
x_stickies = np.sort(np.concatenate([
3018-
artist.sticky_edges.x
3019-
for ax in self._shared_axes["x"].get_siblings(self)
3020-
for artist in ax.get_children()]))
3017+
edges = []
3018+
for ax in self._shared_axes["x"].get_siblings(self):
3019+
for artist in ax.get_children():
3020+
edges.extend(artist.sticky_edges.x)
3021+
x_stickies = np.sort(edges) if edges else np.array([])
30213022
if self._ymargin and scaley and self.get_autoscaley_on():
3022-
y_stickies = np.sort(np.concatenate([
3023-
artist.sticky_edges.y
3024-
for ax in self._shared_axes["y"].get_siblings(self)
3025-
for artist in ax.get_children()]))
3023+
edges = []
3024+
for ax in self._shared_axes["y"].get_siblings(self):
3025+
for artist in ax.get_children():
3026+
edges.extend(artist.sticky_edges.y)
3027+
y_stickies = np.sort(edges) if edges else np.array([])
30263028
if self.get_xscale() == 'log':
30273029
x_stickies = x_stickies[x_stickies > 0]
30283030
if self.get_yscale() == 'log':

0 commit comments

Comments
 (0)