From: Peter G. <pgr...@ge...> - 2004-12-09 20:05:40
|
Perry Greenfield wrote: > > On Dec 9, 2004, at 2:12 PM, Chris Barker wrote: > >> LUK ShunTim wrote: >> >>> As it's being implemented, here is a little wish. I'd like to see >>> the capability of contouring on an arbitrary grid. That is, >>> matplotlab would be able to plot the contours of a function f(x_i, >>> y_i) given on an arbitrary set of points (x_i, y_i), not necessarily >>> set out on a regular grid. >> >> >> This would be nice, but it's a bit of a project. One way to do it >> would be to Delaunay triangulate the points, then you can compute the >> contours from the triangular grid. Delaunay triangulation is not >> trivial, and you really want to use an efficient scheme to do it. One >> possibility is: >> >> http://www-2.cs.cmu.edu/~quake/triangle.html >> >> It is very robust and fast, and can be compiled as a library. I've >> been planning for ages to write a Python wrapper for it, but haven't >> gotten to it yet. >> >> If someone works on this, I'd like to help. >> >> -Chris >> > > Actually, I believe that the low level contour engine we are using > supports this. It takes 2-d arrays for both x and y that represent > the x and y coordinates of the array being contoured and generates > plotting points based on those x and y arrays. These arrays allow > for irregular grids. At the moment, the routine generates uniform > x and y grids as arguments to pass along, but it could be generalized > to take these as extra arguments without much trouble. I use Hardy's multiquadric interpolation to to do the math, then use imshow (or pcolor) to make a surface map. I only have data for the 120 points (where the circle are - those are actuators), and interpolate the rest. If people are interested, I can clean up the code a little and post it. |