Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2220a05

Browse files
committed
fixed print_figure bug in qt, updated fig.set_figsize_inches to point to new figmgr.resize
svn path=/trunk/matplotlib/; revision=2629
1 parent c337b3d commit 2220a05

3 files changed

Lines changed: 4 additions & 2 deletions

File tree

lib/matplotlib/backends/backend_qt.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,6 @@ def configure_subplots(self):
339339
h = int (toolfig.bbox.height())
340340

341341
canvas = self._get_canvas(toolfig)
342-
self.canvas.figure.canvas = self.canvas # Weirdness but needed
343342
tool = SubplotTool(self.canvas.figure, toolfig)
344343
centralWidget = qt.QWidget(win)
345344
canvas.reparent(centralWidget, qt.QPoint(0, 0))

lib/matplotlib/backends/backend_qtagg.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,5 +158,6 @@ def print_figure( self, filename, dpi=150, facecolor='w', edgecolor='w',
158158
agg = self.switch_backends( FigureCanvasAgg )
159159
agg.print_figure( filename, dpi, facecolor, edgecolor, orientation,
160160
**kwargs )
161+
self.figure.set_canvas(self)
161162

162163

lib/matplotlib/figure.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,9 @@ def set_figsize_inches(self, *args, **kwargs):
272272
dpival = self.dpi.get()
273273
canvasw = w*dpival
274274
canvash = h*dpival
275-
self.canvas.resize(int(canvasw), int(canvash))
275+
manager = getattr(self.canvas, 'manager', None)
276+
if manager is not None:
277+
manager.resize(int(canvasw), int(canvash))
276278

277279
def get_size_inches(self):
278280
return self.figwidth.get(), self.figheight.get()

0 commit comments

Comments
 (0)