John,
Alex added facets to pcolormesh today. Eventually we would
like pcolormesh to be a drop-in replacement for pcolor, only
faster. We are also working on performance improvements.
The pcolormesh function can easily identify rectilinear
grids (e.g., when given x,y as vector rather than array)
and use either NonUniformImage or imshow as appropriate.
The facets should be easy enough to draw on top if needed,
though obviously the result will be slower.
In the end we will have two functions: pcolor and imshow,
with pcolor accepting x,y,z and imshow only z.
- Paul
On Jan 19, 2006, at 6:58 PM, John Hunter wrote:
>
> Alex Mont and Paul Kienzle just contributed a patch for more efficient
> handling of quadrilateral meshes, which supports non-rectangular
> meshes.
>
> http://peds-pc311.bsd.uchicago.edu/misc/quadmesh.png
>
> Right now this is *Agg only, but I think/hope they will be adding
> support for other backends in the near future.
>
> Their original patch with detailed description can be found here
>
>
> https://sourceforge.net/tracker/index.php?
> func=detail&aid=1409190&group_id=80706&atid=560722
>
> and I just committed this to CVS.
>
> Combined with Nicholas Young's nonuniform image, this provides some
> new alternatives to those needing efficient pseudo-color plots (see
> http://www.nabble.com/interpolated-pcolor-image-t659211.html for a
> NonuniformImage example)
>
> Thus we now have
>
> pcolor - rectangular, possibly nonuniform mesh with optional facets.
> Slow for large grids. No interpolation.
>
> pcolormesh - Arbitrary quadrilateral meshes, agg only, faster than
> pcolor and more efficient in memory. No interpolation.
>
> imshow - Pseudocolor plots with interpolation but no faceting. Faster
> than pcolor or pcolormesh
>
> NonUniformImage - uses image machinery but supports nonuniform,
> rectangular meshes with interpolation and no faceting. Again,
> faster than pcolor or pcolormesh.
>
> Given the bewildering array of options, it would be nice to have a
> wiki entry with examples showing when and how to use these various
> classes and functions. Volunteers welcome; a good starting point
> would be this email and the example from the nonuniform image link
> above and the discussion by Alex and Paul on the link at the
> sourceforge site.
>
> Here is a quadrilateral mesh example, which is now
> examples/quadmesh_demo.py in CVS.
>
> from matplotlib.mlab import linspace, meshgrid
> import matplotlib.numerix as nx
> from pylab import figure,show
>
> n = 56
> x = linspace(-1.5,1.5,n)
> X,Y = meshgrid(x,x);
> Qx = nx.cos(Y) - nx.cos(X)
> Qz = nx.sin(Y) + nx.sin(X)
> Qx = (Qx + 1.1)
> Z = nx.sqrt(X**2 + Y**2)/5;
> Z = (Z - nx.mlab.amin(Z)) / (nx.mlab.amax(Z) - nx.mlab.amin(Z))
>
> fig = figure()
> ax = fig.add_subplot(111)
> ax.pcolormesh(Qx,Qz,Z)
> show()
>
>
|