From: Gökhan S. <gok...@gm...> - 2010-04-18 16:55:45
|
On Sun, Apr 18, 2010 at 11:47 AM, Darren Dale <dsd...@gm...> wrote: > On Tue, Apr 13, 2010 at 8:14 PM, Gökhan Sever <gok...@gm...> > wrote: > > Hello, > > > > Could someone confirm me if there is any malfunctioning using these > simple > > figure functions? > > > > plt.figure(figsize=(2,3)) > > > > plt.figure(figsize=(5,6)) > > > > plt.figure(figsize=(9,15)) > > > > plt.figure(figsize=(19,5)) > > > > For some reason I can't get Qt4Agg creating last two figures in specified > > sizes. (WXAgg works fine.) > > > > matplotlib.__version__ > > '1.0.svn' > > > > matplotlib.__revision__ > > '$Revision: 8226 $' > > > > from PyQt4 import QtCore > > QtCore.PYQT_VERSION_STR > > '4.7' > > I can reproduce this behavior with a pure pyqt4 example with no mpl > code, see below. I asked for advice on the pyqt mailing list. > > import sys > from PyQt4 import QtCore, QtGui > > class Test(QtGui.QWidget): > > def __init__(self, width, height): > QtGui.QWidget.__init__(self) > #self.setSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) > print 'Central widget should have width=%d, height=%d' %(width, > height) > self._width = width > self._height = height > > def sizeHint(self): > return QtCore.QSize(self._width, self._height) > > app = QtGui.QApplication([]) > m = QtGui.QMainWindow() > c = Test(1000, 700) > m.setCentralWidget(c) > m.show() > s = c.size() > print 'but central widget has width=%d, height=%d'% (s.width(), s.height()) > sys.exit(app.exec_()) > Same here with your sample: Central widget should have width=1000, height=700 but central widget has width=960, height=600 I resorted to WXAgg for the time being. Waiting for some updates till I hear a resolution. The annoying part is when I created a plot using specified width and height Qt4Agg doesn't follow these dimensions as in this case and resulting savefig(file.pdf) produces wrongly sized file unless I manually extend the figure area and re-issue a savefig afterwards. -- Gökhan |