Image Zooming and Dragging

Hi,

I'm trying to create an application that, among other things, will allow me to view an image, zoom into it, and move it around. Essentially what I can do by using imshow and show in ipython. However, I've noticed that in both interactive usage and my application the image comes up in a small set of axes that do not fill up the screen 100% (the image is rectangular). Zooming or dragging the image around then causes part of it to go off the axes, which is not desirable.

What I would like to do is increase the size of the area where the image can be displayed to the area given to the canvas in my application. Then, if I drag the image around, part of it won't disappear. However, I'm not really sure how to do this. What is the best way to accomplish this goal (preferably for non-interactive usage - I'm using the QT4 back end)?

Thank you in advance,
David Levitan

You can set the size of the axes you want using

ax = fig.add_axes([left, bottom, width, height])

where all numbers are fractions of figure size, eg

ax = fig.add_axes([0.1, 0.1, 0.8, 0.8])

My guess is what you are experiencing may result from the image aspect
handling. Try setting the aspect to 'auto' when you create your image

ax.imshow(X, aspect=' auto')

JDH

ยทยทยท

On 2/4/07, David Levitan <david@...1395...> wrote:

I'm trying to create an application that, among other things, will allow
me to view an image, zoom into it, and move it around. Essentially what
I can do by using imshow and show in ipython. However, I've noticed that
in both interactive usage and my application the image comes up in a
small set of axes that do not fill up the screen 100% (the image is
rectangular). Zooming or dragging the image around then causes part of
it to go off the axes, which is not desirable.

What I would like to do is increase the size of the area where the image
can be displayed to the area given to the canvas in my application.
Then, if I drag the image around, part of it won't disappear. However,
I'm not really sure how to do this. What is the best way to accomplish
this goal (preferably for non-interactive usage - I'm using the QT4 back
end)?