Skip to content

Commit 5c90416

Browse files
committed
FIX: correctly restore the size of unpickled figures with hi-dpi
The issue is that we reset the dpi but did not re-compute any of the bounding boxes derived from the dpi leading to the initial redraw events to use the wrong physical size on the screen. Closes matplotlib#27224
1 parent c0041fb commit 5c90416

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/matplotlib/figure.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3321,8 +3321,9 @@ def __setstate__(self, state):
33213321
self.__dict__ = state
33223322

33233323
# re-initialise some of the unstored state information
3324-
FigureCanvasBase(self) # Set self.canvas.
3325-
3324+
self._set_base_canvas()
3325+
# force the bounding boxes to respect current dpi
3326+
self.dpi_scale_trans.clear().scale(self._dpi)
33263327
if restore_to_pylab:
33273328
# lazy import to avoid circularity
33283329
import matplotlib.pyplot as plt

0 commit comments

Comments
 (0)