Re: [Matplotlib-users] Problem with figure sizes using Qt4Agg

2010-05-04 Thread Gökhan Sever
On Mon, May 3, 2010 at 4:02 PM, Darren Dale dsdal...@gmail.com wrote:


 I got a suggestion at the PyQt4 mailing list, and the following patch
 appears to resolve the problem.

 Darren


Thanks Darren.

Your patch fixes the wrong sized figure creation problem. Both for WXAgg and
Qt4Agg the maximum figure size is limited with the physical screen
dimensions, right? Just out of curiosity I am asking this. I don't see any
scroll-bars appearing if one figure dimension is bigger than screen's.

-- 
Gökhan
--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Problem with figure sizes using Qt4Agg

2010-05-04 Thread Darren Dale
On Tue, May 4, 2010 at 10:58 AM, Gökhan Sever gokhanse...@gmail.com wrote:


 On Mon, May 3, 2010 at 4:02 PM, Darren Dale dsdal...@gmail.com wrote:

 I got a suggestion at the PyQt4 mailing list, and the following patch
 appears to resolve the problem.

 Darren


 Thanks Darren.

 Your patch fixes the wrong sized figure creation problem. Both for WXAgg and
 Qt4Agg the maximum figure size is limited with the physical screen
 dimensions, right? Just out of curiosity I am asking this. I don't see any
 scroll-bars appearing if one figure dimension is bigger than screen's.

The change was committed in svn 8294. No, the figure windows are not
designed to include scrollbars if the canvas is bigger than the window
will allow. I don't think such a feature would be compatible with the
current ability to resize a canvas by resizing the figure window.

Darren

--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Problem with figure sizes using Qt4Agg

2010-05-03 Thread Darren Dale
On Sun, Apr 18, 2010 at 12:55 PM, Gökhan Sever gokhanse...@gmail.com wrote:


 On Sun, Apr 18, 2010 at 11:47 AM, Darren Dale dsdal...@gmail.com wrote:

 On Tue, Apr 13, 2010 at 8:14 PM, Gökhan Sever gokhanse...@gmail.com
 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.

I got a suggestion at the PyQt4 mailing list, and the following patch
appears to resolve the problem. However, before I commit the change,
I'd like to hear from John or Andrew: What is the protocol for dealing
with a change that may affect unit tests?

Darren

Index: lib/matplotlib/backends/backend_qt4.py
===
--- lib/matplotlib/backends/backend_qt4.py  (revision 8292)
+++ lib/matplotlib/backends/backend_qt4.py  (working copy)
@@ -318,6 +318,11 @@
 QtCore.QObject.connect(self.toolbar, QtCore.SIGNAL(message),
 self.window.statusBar().showMessage)

+cs = canvas.sizeHint()
+tbs = self.toolbar.sizeHint()
+sbs = self.window.statusBar().sizeHint()
+self.window.resize(cs.width(), cs.height()+tbs.height()+sbs.height())
+
 self.window.setCentralWidget(self.canvas)

 if matplotlib.is_interactive():

--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Problem with figure sizes using Qt4Agg

2010-05-03 Thread John Hunter
On Mon, May 3, 2010 at 4:02 PM, Darren Dale dsdal...@gmail.com wrote:
 On Sun, Apr 18, 2010 at 12:55 PM, Gökhan Sever gokhanse...@gmail.com wrote:


 On Sun, Apr 18, 2010 at 11:47 AM, Darren Dale dsdal...@gmail.com wrote:

 On Tue, Apr 13, 2010 at 8:14 PM, Gökhan Sever gokhanse...@gmail.com
 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.

 I got a suggestion at the PyQt4 mailing list, and the following patch
 appears to resolve the problem. However, before I commit the change,
 I'd like to hear from John or Andrew: What is the protocol for dealing
 with a change that may affect unit tests?


This shouldn't affects tests I don't think because it is a change to a
GUI backend and we are only doing unit tests on hardcopy images at
this point.

In general, run matplotlib.test


   python -c 'import matplotlib; matplotlib.test()'


and look to see if any tests are failing. If any are, either fix the
problem or if you decide the baseline image is broken update that in
lib/matplotlib/tests/baseline_images.  There is more in
doc/devel/coding_guide.rst under Testing.  Andrew may have more to
add...

JDH

--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Problem with figure sizes using Qt4Agg

2010-04-18 Thread Darren Dale
On Tue, Apr 13, 2010 at 8:14 PM, Gökhan Sever gokhanse...@gmail.com 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_())

--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Problem with figure sizes using Qt4Agg

2010-04-18 Thread Gökhan Sever
On Sun, Apr 18, 2010 at 11:47 AM, Darren Dale dsdal...@gmail.com wrote:

 On Tue, Apr 13, 2010 at 8:14 PM, Gökhan Sever gokhanse...@gmail.com
 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
--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users