Skip to content

Commit b45f72c

Browse files
committed
Fix interactive qt savefig.
1 parent 1dd13c4 commit b45f72c

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

lib/mplcairo/qt.py

+11
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,17 @@ def blit(self, bbox=None): # matplotlib#17478 (<3.3).
4949
# See above: we always repaint the full canvas.
5050
self.repaint(self.rect())
5151

52+
def print_figure(self, *args, **kwargs):
53+
# Similar to matplotlib#26309: Qt may trigger a redraw after closing
54+
# the file save dialog, in which case we don't want to redraw based on
55+
# the savefig-generated renderer but the earlier, gui one.
56+
lrc = self._last_renderer_call
57+
self._last_renderer_call = None, None
58+
try:
59+
super().print_figure(*args, **kwargs)
60+
finally:
61+
self._last_renderer_call = lrc
62+
5263

5364
@_BackendQT.export
5465
class _BackendQTCairo(_BackendQT):

0 commit comments

Comments
 (0)