Skip to content

Commit b39bd9d

Browse files
committed
FIX: Apply aspect before drawing starts
1 parent e2625d0 commit b39bd9d

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

lib/matplotlib/axes/_base.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2546,12 +2546,6 @@ def draw(self, renderer=None, inframe=False):
25462546

25472547
# prevent triggering call backs during the draw process
25482548
self._stale = True
2549-
locator = self.get_axes_locator()
2550-
if locator:
2551-
pos = locator(self, renderer)
2552-
self.apply_aspect(pos)
2553-
else:
2554-
self.apply_aspect()
25552549

25562550
artists = self.get_children()
25572551
artists.remove(self.patch)

lib/matplotlib/figure.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1630,6 +1630,23 @@ def draw(self, renderer):
16301630
if not artist.get_animated()),
16311631
key=lambda artist: artist.get_zorder())
16321632

1633+
for ax in self.axes:
1634+
locator = ax.get_axes_locator()
1635+
if locator:
1636+
pos = locator(ax, renderer)
1637+
ax.apply_aspect(pos)
1638+
else:
1639+
ax.apply_aspect()
1640+
1641+
for child in ax.get_children():
1642+
if hasattr(child, 'apply_aspect'):
1643+
locator = child.get_axes_locator()
1644+
if locator:
1645+
pos = locator(child, renderer)
1646+
child.apply_aspect(pos)
1647+
else:
1648+
child.apply_aspect()
1649+
16331650
try:
16341651
renderer.open_group('figure')
16351652
if self.get_constrained_layout() and self.axes:

0 commit comments

Comments
 (0)