diff --git a/lib/matplotlib/animation.py b/lib/matplotlib/animation.py index 7909d11352b7..9b9cb910c01e 100644 --- a/lib/matplotlib/animation.py +++ b/lib/matplotlib/animation.py @@ -1199,9 +1199,16 @@ def _setup_blit(self): # axes self._blit_cache = dict() self._drawn_artists = [] + # _post_draw needs to be called first to initialize the renderer + self._post_draw(None, self._blit) + # Then we need to clear the Frame for the initial draw + # This is typically handled in _on_resize because QT and Tk + # emit a resize event on launch, but the macosx backend does not, + # thus we force it here for everyone for consistency + self._init_draw() + # Connect to future resize events self._resize_id = self._fig.canvas.mpl_connect('resize_event', self._on_resize) - self._post_draw(None, self._blit) def _on_resize(self, event): # On resize, we need to disable the resize event handling so we don't diff --git a/src/_macosx.m b/src/_macosx.m index 2beeda14722d..4fc6322bf0a2 100755 --- a/src/_macosx.m +++ b/src/_macosx.m @@ -1329,6 +1329,8 @@ - (void)updateDevicePixelRatio:(double)scale goto exit; } if (PyObject_IsTrue(change)) { + // Notify that there was a resize_event that took place + gil_call_method(canvas, "resize_event"); [self setNeedsDisplay: YES]; }