From: Pieter D. <pie...@gm...> - 2006-08-18 12:26:31
|
Hi, I'm trying to generate a contour plot with logarithmic axes. I'm generating data on a grid defined by logspaces: x_range = logspace(log10(xstart),log10(xend),num=25) y_range = logspace(log10(ystart),log10(yend),num=25) Then, to generate the plot I do the following: [X,Y]=pylab.meshgrid(log10(x_range),log10(y_range)) pylab.contourf(X,Y,transpose(data)) And to obtain nicer tick mark labels, this dirty way: xmajorForm = pylab.FormatStrFormatter('10e%.1f') ax.xaxis.set_major_formatter(xmajorForm) ymajorForm = pylab.FormatStrFormatter('10e%.1f') ax.yaxis.set_major_formatter(ymajorForm) Are there better ways to (1) set the x and y xis scaling to logarithmic, and to (2) obtain nicely formatted tick mark labels ? I tried playing around with the x and y axis data and with LogLocator and LogFormatter but it doesn't seem to do the job. Pieter |