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]]))


On Wed, Aug 1, 2012 at 8:56 PM, Stan West <stan.w...@nrl.navy.mil> wrote:

> **
>
> *From:* Mark Bakker [mailto:mark...@gmail.com]
> *Sent:* Monday, July 30, 2012 05:54
>
> Hello List,
>
> I am trying to determine the position of the axes after an imshow and am
> having problems.
> I get a different answer on my Mac (the correct answer) than Windows (the
> wrong answer).
>
> [...]
>
> Any thoughts? When I type the commands in at the IPython prompt it works
> most of the time (on Windows), but it never works when running the file.
> What in the world could be different?
>
> mp version 1.1.0 on both systems.
>
>  Are you using the same backend on both systems?
>
> Perhaps when you run the script within IPython on your Windows system, the
> show() call is not triggering a draw. You can force drawing by calling
> draw() before show(). I hope that helps.
>
------------------------------------------------------------------------------
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