showing an image on log axes?

Hi all, I have a PNG image that I would like to mount on

    > log-log axes. The points in the image correspond to computed
    > values on a log-log scale, so no scaling of the image is
    > required: I just want to stick it on top of suitably-marked
    > axes. It would be great if I could then overlay some dot
    > points as well.

    > Is this possible with matplotlib? Can anyone give me some
    > pointers on how to do it? Or a better tool for this?

I'm not sure from your post if the log scale applies to the implicit
xy coords of the pixels, or to the intensity of the pixels. I'm
assuming the former below (if it's the latter you probably want custom
normalize and colormap objects).

logarithmic xy pixel locations may be possible with a NonuniformImage.
Take a look at the following for example code

http://article.gmane.org/gmane.comp.python.matplotlib.general/4050

I'm not sure that this will work since I haven't tried it, but it's
the best bet as far as I can see.

See how far you can get with it and if you get stuck, post a code
example and CC Nicholas and we'll see if we can progress.

JDH

Hi John,

The image is correct when plotted using i=imread('plot.png') then
imshow(i), but I want to add axes. I generated the image directly using
GTK commands, then saved the pixbuf as png. The pixels in the image
correspond to sample points in both x- and y-directions generated using
exp(linspace(log(low),log(high),num). Why is there no logspace in
matplotlib, btw?

All I basically need is a way to say what the range and distribution of
the pixels is: I don't want the axes to default to integer-numbered
linear-spaced values as they currently do.

I tried to see if I could use the set_xscale command but it seems to be
internal and/or only applicable to polar plots?

There's an ASCII mockup of what I'm wanting below. As I said, the image
doesn't need to be stretched, just stuck straight on the right axes.

Cheers
JP

10 +-----|-----|-----+
   > >
   > >
1 + + + +
   > >
   > my image here |
0.1+ + + +
   > >
   > >
e-3+-----+-----+-----+
  0.1 1 10 100

John Hunter wrote:

···

            
    > Hi all, I have a PNG image that I would like to mount on
    > log-log axes. The points in the image correspond to computed
    > values on a log-log scale, so no scaling of the image is
    > required: I just want to stick it on top of suitably-marked
    > axes. It would be great if I could then overlay some dot
    > points as well.

    > Is this possible with matplotlib? Can anyone give me some
    > pointers on how to do it? Or a better tool for this?

I'm not sure from your post if the log scale applies to the implicit
xy coords of the pixels, or to the intensity of the pixels. I'm
assuming the former below (if it's the latter you probably want custom
normalize and colormap objects).

logarithmic xy pixel locations may be possible with a NonuniformImage.
Take a look at the following for example code

http://article.gmane.org/gmane.comp.python.matplotlib.general/4050

I'm not sure that this will work since I haven't tried it, but it's
the best bet as far as I can see.

See how far you can get with it and if you get stuck, post a code
example and CC Nicholas and we'll see if we can progress.

JDH

--
John Pye
School of Mechanical and Manufacturing Engineering
The University of New South Wales
Sydney NSW 2052 Australia
t +61 2 9385 5127
f +61 2 9663 1222
mailto:john.pye_AT_student_DOT_unsw.edu.au