>>>>> "James" == James Boyle <boyle5@...> writes:
James> Until contouring is implemented, the only way to display 2D
James> data is by pcolor. I have two observations:
James> (1) While trying to figure out exactly what pcolor was
James> doing ( I did not understand the grid registration) I
James> looked into the matlab documentation. The matlab docs
James> explained what was going on, so that I could get my values
James> properly aligned on the grid. This brings up a question -
James> How close does matplotlib follow Matlab? Will there always
James> be such a close correspondence in the implementation of
James> 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?
James> (2) To do quantitative representation using pcolor, a
James> colorbar function is needed. This feature does not appear
James> on the list of future goals, I would like it to be
James> added. I'm not that competent, but I will give it a try
James> myself. The first few easy things I tried did not work out.
Agreed. I just implemented this. Unzip the following in your
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
cmap = ColormapJet(256)
Let me know how it goes!