Imagine your arrays had points (Cartesian position
> vectors) all over the place at completely random points
> in space. The 'shape' of this plot depends on max and
> min values of each coordinate. I believe Mathematica
> plotting would automagically calculate these max and min
> values and set plot ranges for you. This is why 'shape'
> attribute of Matplotlib/Numarray seems awkward and
> unnecessary to me unless I'm missing something.
There are a variety of issues here.
- The "shape" attribute comes form Numeric/numarray and is outside
the realm of matplotlib. matplotlib plots numerix arrays.
- The pcolor interface is determined by matlab. matlab has a pcolor
function which I have tried to implement faithfully. To the
extent that matplotlib has been successful, this is due in part
because matlab has a good interface for plotting and replicating
it generally, is a good thing.
- Storing the "shape" of a data set allows for memory and efficiency
savings. To take your example of a set of x,y,z points, you are
right you cold reconstruct rectilinear grid from this data -- one
might have to use interpolation but it can be done -- but it would
require a lot of unnecessary computation for data which already
lives on a grid. So pcolor assumes your data are on a rectilinear
grid and it is incumbent upon you to get it into that form.
The meshgrid function takes regularly sampled vector data and
turns it into a rectilinear grid (this is also a matlab function).
The matlab griddata function (which is not yet implemented in
matplotlib) does the same for irregularly sampled data.
JDH