Hello all,

several of my colleagues and I are 99% sure we are making the change from IDL to python-matplotlib. I have just one issue that I am trying to work out that I need to solve. We are so far really impressed and looking forward to the change.

I have seen discussion on this list about imagesc and imshow but none of them have quite answered the questions. In IDL we spent way too much time writing an clone that is still not full featured:

http://people.bu.edu/balarsen/IDLdoc/imagesc.html

I have data of probability distributions which have an X and Y array associated with the axes of the 2-d distribution (image). What I don't see how to do in any easy fashion is plot this data in a imshow() manner with the axes correct (which are unevenly distributed and need to be plotted on a log axes).

This can be done with contourf(X,Y,Z) but this has a few issues:

- I dont see how to do a log axes on a contour

- contour is the wrong plot as the inherent smoothing that a contour does is highly undesirable.

Using matlab imagesc one can easily make plots similar to:

http://img269.yfrog.com/i/2dprob.png/

Imagine taking the above plot and make the "pixels" different sizes so that each "pixel" has identical counting statistics. Now assume that one wanted the Y-axis to be plotted in log.

Anyone have any thoughts or toy examples?

Thanks much,

Brian

## ยทยทยท

--

-----------------------------------------------------------

Brian A Larsen

RBSP-ECT Instrument Suite Scientist

Boston University

Center for Space Physics

725 Commonwealth Ave, Rm 506

Boston, MA 02215-1401

T: 617-358-4945

F: 617-353-6463

balarsen --at -- bu.edu

Brian Larsen wrote:

Hello all,

several of my colleagues and I are 99% sure we are making the change from IDL to python-matplotlib. I have just one issue that I am trying to work out that I need to solve. We are so far really impressed and looking forward to the change.

I have seen discussion on this list about imagesc and imshow but none of them have quite answered the questions. In IDL we spent way too much time writing an clone that is still not full featured:

http://people.bu.edu/balarsen/IDLdoc/imagesc.html

I have data of probability distributions which have an X and Y array associated with the axes of the 2-d distribution (image). What I don't see how to do in any easy fashion is plot this data in a imshow() manner with the axes correct (which are unevenly distributed and need to be plotted on a log axes).

This can be done with contourf(X,Y,Z) but this has a few issues:

- I dont see how to do a log axes on a contour

- contour is the wrong plot as the inherent smoothing that a contour does is highly undesirable.

Using matlab imagesc one can easily make plots similar to:

http://img269.yfrog.com/i/2dprob.png/

Imagine taking the above plot and make the "pixels" different sizes so that each "pixel" has identical counting statistics. Now assume that one wanted the Y-axis to be plotted in log.

Anyone have any thoughts or toy examples?

I am not sure I understand exactly what you want to do, but it sounds like pcolormesh would do it. e.g. with ipython -pylab:

ax = gca()

ax.set_yscale('log')

x = np.arange(10)**1.5

y = np.arange(20)**1.8

z = x[1:] * y[1:, np.newaxis]

pcolormesh(x, y, z)

axis('tight')

Note that with x and y, which can be 1-D or 2-D, you are specifying the grid boundaries, not the pixel centers.

Eric