Can I change pixel aspect with axes_grid

Usually imshow(arr, aspect='auto') or imshow(arr, aspect=2.0) will
display the image with pixels having some aspect ratio other than 1:1
However, I cannot get this to work when using imshow within an AxesGrid axis.
Is there a way to get an array shown with imshow() within an AxesGrid
axis to have a pixel aspect other than 1:1 ?
If not, is there a simple way to add a shared colorbar when using subplots() ?

Gary

Usually imshow(arr, aspect='auto') or imshow(arr, aspect=2.0) will
display the image with pixels having some aspect ratio other than 1:1
However, I cannot get this to work when using imshow within an AxesGrid axis.
Is there a way to get an array shown with imshow() within an AxesGrid
axis to have a pixel aspect other than 1:1 ?
If not, is there a simple way to add a shared colorbar when using subplots() ?

By shared colorbar, do you mean something like this?
http://matplotlib.sourceforge.net/examples/pylab_examples/multi_image.html

It is using ordinary axes, and is a bit more complex than needed for many purposes.

Eric

···

On 08/19/2011 07:43 PM, gruben@...636... wrote:

Gary

------------------------------------------------------------------------------
Get a FREE DOWNLOAD! and learn more about uberSVN rich system,
user administration capabilities and model configuration. Take
the hassle out of deploying and managing Subversion and the
tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

If you want aspect="auto", this must also be set when you create ImageGrid.
A simple example is attached.
If you want a fixed aspect other than 1, it is doable but gets a bit
tricky. Let me know if this is what you want.

Regards,

-JJ

from mpl_toolkits.axes_grid1 import ImageGrid

fig = plt.figure(1)

grid = ImageGrid(fig, 111, (2, 1),
                 aspect=False,
                 label_mode='L', cbar_mode="single",
                 )

arr = np.arange(100).reshape((10, 10))
im1 = grid[0].imshow(arr, aspect="auto")
im2 = grid[1].imshow(arr, aspect="auto")

grid[0].cax.colorbar(im1)

···

On Sat, Aug 20, 2011 at 2:43 PM, gruben@...636... <gruben@...636...> wrote:

Usually imshow(arr, aspect='auto') or imshow(arr, aspect=2.0) will
display the image with pixels having some aspect ratio other than 1:1
However, I cannot get this to work when using imshow within an AxesGrid axis.
Is there a way to get an array shown with imshow() within an AxesGrid
axis to have a pixel aspect other than 1:1 ?
If not, is there a simple way to add a shared colorbar when using subplots() ?

Gary

------------------------------------------------------------------------------
Get a FREE DOWNLOAD! and learn more about uberSVN rich system,
user administration capabilities and model configuration. Take
the hassle out of deploying and managing Subversion and the
tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

Thanks Eric and JJ,

Both of your answers are solutions to my problem actually.
I spent a while trying to figure this out and didn't get anywhere.
This was an exercise in frustration with matplotlib's documentation.
Thankfully this list and its members are here to save us. I assumed it
was just a simple flag or option I had missed and this turned out to
be the case. I had even tried setting aspect=False when creating my
AxesGrid object and setting aspect="auto", but because I was poking
around in the dark, I must not have set both at the same time. I also
thought I'd seen an example of this somewhere, which is what Eric
pointed out, but even thinking I'd seen it, I couldn't find it again.
I had looked in the gallery but missed the example - looking back at
the gallery now, I think it might be because every other related
example uses the jet colour scheme and it simply didn't register.

regards,
Gary

···

On Sat, Aug 20, 2011 at 6:49 PM, Jae-Joon Lee <lee.j.joon@...287...> wrote:

If you want aspect="auto", this must also be set when you create ImageGrid.
A simple example is attached.
If you want a fixed aspect other than 1, it is doable but gets a bit
tricky. Let me know if this is what you want.

Regards,

-JJ

from mpl_toolkits.axes_grid1 import ImageGrid

fig = plt.figure(1)

grid = ImageGrid(fig, 111, (2, 1),
aspect=False,
label_mode='L', cbar_mode="single",
)

arr = np.arange(100).reshape((10, 10))
im1 = grid[0].imshow(arr, aspect="auto")
im2 = grid[1].imshow(arr, aspect="auto")

grid[0].cax.colorbar(im1)

On Sat, Aug 20, 2011 at 2:43 PM, gruben@...636... > <gruben@...636...> wrote:

Usually imshow(arr, aspect='auto') or imshow(arr, aspect=2.0) will
display the image with pixels having some aspect ratio other than 1:1
However, I cannot get this to work when using imshow within an AxesGrid axis.
Is there a way to get an array shown with imshow() within an AxesGrid
axis to have a pixel aspect other than 1:1 ?
If not, is there a simple way to add a shared colorbar when using subplots() ?

Gary

------------------------------------------------------------------------------
Get a FREE DOWNLOAD! and learn more about uberSVN rich system,
user administration capabilities and model configuration. Take
the hassle out of deploying and managing Subversion and the
tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options