From 2046cde36058c433039496206f65aceb32488de7 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Wed, 29 Apr 2020 21:14:10 -0400 Subject: [PATCH] Backport PR #17261: avoid calling wx.Bitmap() if width or height is zero --- lib/matplotlib/backends/backend_wx.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/matplotlib/backends/backend_wx.py b/lib/matplotlib/backends/backend_wx.py index 1c7e0c7df7e6..d74646defd19 100644 --- a/lib/matplotlib/backends/backend_wx.py +++ b/lib/matplotlib/backends/backend_wx.py @@ -776,14 +776,14 @@ def _onSize(self, evt): # no change in size return self._width, self._height = size - # Create a new, correctly sized bitmap - self.bitmap = wx.Bitmap(self._width, self._height) - self._isDrawn = False if self._width <= 1 or self._height <= 1: return # Empty figure + # Create a new, correctly sized bitmap + self.bitmap = wx.Bitmap(self._width, self._height) + dpival = self.figure.dpi winch = self._width / dpival hinch = self._height / dpival