Changing axis units, with imshow()

Hi,

I am trying to plot an image with matplotlib and change the default axis units.

Using the cookbook recipe (import image with PIL, and use imshow() ).
I am able to get matplotlib to display the image, but the axis are
just the x and y pixel numbers.

I'd like to convert them to something else. Ie

y_value = ypixel * (131/1608)
x_value = xpixel * (5/60)

I am really struggling here and have been at it since yesterday. There
must be a simple way of doing this that is evading me.

Thanks,

Ciarán

Ciarán Mooney wrote:

Hi,

I am trying to plot an image with matplotlib and change the default axis units.

Using the cookbook recipe (import image with PIL, and use imshow() ).
I am able to get matplotlib to display the image, but the axis are
just the x and y pixel numbers.

I'd like to convert them to something else. Ie

y_value = ypixel * (131/1608)
x_value = xpixel * (5/60)

I am really struggling here and have been at it since yesterday. There
must be a simple way of doing this that is evading me.
  

You want the "extent" keyword argument. E.g. pylab.imshow( pixels,
extent=(0,131,0,5) ) if pixels has dimensions 1608 wide and 60 high to
match your above attempt.