Skip to content

Commit a2f0415

Browse files
committed
FIX: Apply aspect before drawing starts
1 parent 4bc1ca9 commit a2f0415

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

lib/matplotlib/axes/_base.py

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

25432543
# prevent triggering call backs during the draw process
25442544
self._stale = True
2545-
locator = self.get_axes_locator()
2546-
if locator:
2547-
pos = locator(self, renderer)
2548-
self.apply_aspect(pos)
2549-
else:
2550-
self.apply_aspect()
25512545

25522546
artists = self.get_children()
25532547
artists.remove(self.patch)

lib/matplotlib/figure.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1633,6 +1633,24 @@ def draw(self, renderer):
16331633
if not artist.get_animated()),
16341634
key=lambda artist: artist.get_zorder())
16351635

1636+
for ax in self.axes:
1637+
locator = ax.get_axes_locator()
1638+
if locator:
1639+
pos = locator(ax, renderer)
1640+
ax.apply_aspect(pos)
1641+
else:
1642+
ax.apply_aspect()
1643+
1644+
ax.apply_aspect()
1645+
for child in ax.get_children():
1646+
if hasattr(child, 'apply_aspect'):
1647+
locator = child.get_axes_locator()
1648+
if locator:
1649+
pos = locator(child, renderer)
1650+
child.apply_aspect(pos)
1651+
else:
1652+
child.apply_aspect()
1653+
16361654
try:
16371655
renderer.open_group('figure')
16381656
if self.get_constrained_layout() and self.axes:

0 commit comments

Comments
 (0)