From: Stefan v. d. W. <st...@su...> - 2006-06-15 09:26:38
|
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" >=20 > from pylab import figure, show, nx > fig =3D figure() > ax =3D fig.add_subplot(111) > im =3D nx.mlab.rand(500,500) > ax.imshow(im, extent=3D(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=3D(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=E9fan |