8000 FIX: Apply aspect before drawing starts · matplotlib/matplotlib@f1e3742 · GitHub
[go: up one dir, main page]

Skip to content
< 8000 script crossorigin="anonymous" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_remote-form_dist_index_js-node_modules_delegated-events_dist_inde-94fd67-99b04cc350b5.js" defer="defer">

Commit f1e3742

Browse files
committed
FIX: Apply aspect before drawing starts
1 parent b9b02f1 commit f1e3742

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
@@ -2543,12 +2543,6 @@ def draw(self, renderer=None, inframe=False):
25432543

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

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

lib/matplotlib/figure.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1633,6 +1633,23 @@ 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+
for child in ax.get_children():
1645+
if hasattr(child, 'apply_aspect'):
1646+
locator = child.get_axes_locator()
1647+
if locator:
1648+
pos = locator(child, renderer)
1649+
child.apply_aspect(pos)
1650+
else:
1651+
child.apply_aspect()
1652+
16361653
try:
16371654
renderer.open_group('figure')
16381655
if self.get_constrained_layout() and self.axes:

0 commit comments

Comments
 (0)
0