From: Mark Bakker [mailto:mark...@gmail.com] 
Sent: Tuesday, August 07, 2012 06:42
 
I tried a few things and found out that doing a pause works. 
So why does a pause work, but a draw() or show() does not?
This all on Windows using the standard PythonXY installation.
Here is the code that works (testimage.py):


from pylab import *
c = ones((10,20))
ax = imshow(c)
pause(0.01)
print ax.get_axes().get_position()


Running from IPython: 
run testimage
Bbox(array([[ 0.125     ,  0.24166667],
       [ 0.9       ,  0.75833333]]))

I modified your script to test show(), draw(), and pause(); it's attached. For
the WXAgg matplotlib backend, I get:

In [1]: print(matplotlib.get_backend())
WXAgg
In [2]: %run testimage
show:  Bbox(array([[ 0.125,  0.1  ],
       [ 0.9  ,  0.9  ]]))
draw:  Bbox(array([[ 0.125     ,  0.24166667],
       [ 0.9       ,  0.75833333]]))
pause:  Bbox(array([[ 0.125     ,  0.24166667],
       [ 0.9       ,  0.75833333]]))

but for the Qt4Agg backend, I get:

In [1]: print(matplotlib.get_backend())
Qt4Agg
In [2]: %run testimage
show:  Bbox(array([[ 0.125,  0.1  ],
       [ 0.9  ,  0.9  ]]))
draw:  Bbox(array([[ 0.125,  0.1  ],
       [ 0.9  ,  0.9  ]]))
pause:  Bbox(array([[ 0.125     ,  0.24166667],
       [ 0.9       ,  0.75833333]]))

Which backend have you been using?

from pylab import *

c = ones((10,20))

img = imshow(c)
show()
print 'show: ', img.get_axes().get_position()
close()

img = imshow(c)
draw()
print 'draw: ', img.get_axes().get_position()
close()

img = imshow(c)
pause(0.01)
print 'pause: ', img.get_axes().get_position()
close()
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to