Numpy has a logspace function, so it may be a bad idea to create a function in pylab with the same name that does something slightly different.
def logspace(start,stop,num=50,endpoint=True,base=10.0):
"""Evenly spaced numbers on a logarithmic scale.
Computes int(num) evenly spaced exponents from start to stop.
If endpoint=True, then last exponent is stop.
Returns base**exponents.
"""
y = linspace(start,stop,num=num,endpoint=endpoint)
return _nx.power(base,y)
David
2006/6/15, Stefan van der Walt <[EMAIL PROTECTED]>:
On Tue, Jun 13, 2006 at 06:21:22AM -0500, John Hunter wrote:
> 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))
I often want to plot matrices, with the axes labeled according to the
matrix index. I.e. the top-lefthand element should be (0,0) and the
bottom-righthand element (rows,columns). Setting the extent does
work, i.e.
ax.imshow(im,extent=(1,columns,rows,1))
If others also use this frequently, it may be useful to have a quick
way of doing it (or maybe, there already is, and I've missed it).
Regards
Stéfan
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
_______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users