>>>>> "John" == John Pye <[EMAIL PROTECTED]> writes:

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

I'll be happy to add it -- how about sending a version?

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

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


setting the xscale and yscale to 'log' should work fine, as long as
you make sure the xaxis and yaxis do not contain nonpositive limits.
For an MxN image, the default limits are 0..N-1 and 0..M-1 and the 0
will break the log transform.  You can work around this by setting the
image "extent"

  from pylab import figure, show, nx
  fig = figure()
  ax = fig.add_subplot(111)
  im = nx.mlab.rand(500,500)
  ax.imshow(im, extent=(1,501,1,501))
  ax.set_xscale('log')
  ax.set_yscale('log')
  show()

Hope this helps,
JDH


_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to