pseudo-color questions

Until contouring is implemented, the only way to display 2D

    > data is by pcolor. I have two observations:

    > (1) While trying to figure out exactly what pcolor was
    > doing ( I did not understand the grid registration) I
    > looked into the matlab documentation. The matlab docs
    > explained what was going on, so that I could get my values
    > properly aligned on the grid. This brings up a question -
    > How close does matplotlib follow Matlab? Will there always
    > be such a close correspondence in the implementation of
    > functions such as I found in pcolor?

The matlab interface tries to follow matlab pretty closely, but not
religiously. For example, in matlab you can say


where Y is MxN and it will plot all the data in the array. matplotlib
doesn't handle this case, currently. In the case of errorbar, it made
more sense to extend the features (eg to support x and y asymmetric
errorbars) than slavishly follow the matlab signature.

All other things being equal I try and implement the matlab signature.
It's usually a good motivator because it encourages you to add
features at design time that you might be tempted to leave out.

Why do you ask?

    > (2) To do quantitative representation using pcolor, a
    > colorbar function is needed. This feature does not appear
    > on the list of future goals, I would like it to be
    > added. I'm not that competent, but I will give it a try
    > myself. The first few easy things I tried did not work out.

Agreed. I just implemented this. Unzip the following in your
site-packages dir

After you have created a pcolor, just do


This will resize your axes to make room for the colorbar and display a
vertical colorbar (I haven't yet supported horizontal colorbars, as
matlab does). If you want to use non-default limits for the colormap,
call cmap.set_clim(cmin, cmax) before the pcolor and colorbar, as in
this example

  cmap = ColormapJet(256)
  cmap.set_clim(cmin, cmax)
  pcolor(Z, cmap=cmap)

Let me know how it goes!