From: Peter G. <pgr...@ge...> - 2004-04-14 18:45:35
|
Hello Everyone: Before I reinvent the wheel, I'd thought I'd ask: I have a set of x,y points in a plane, and to each a corresponding z. They are spread out in circular concentric orbits. I need to do a flat surface plot (via pcolor) of these z values. A simple algorithm would be: #get data for x, y, z.. this would be some fixed points x,y inside #a box -4<=x<=4 and -4<=y<=4 with a z value for each. #Create a grid xi=linspace(-4,4,200) yi=linspace(-4,4,200) [Xi,Yi]=meshgrid(xi,yi) # This is the key step; find a z value for each grid point. Zi=griddata(x,y,z,Xi,Yi) pcolor(Xi, Yi, Zi, shading='flat') show() The key here is this griddata function. It interpolates the surface at the grid points based on the few data points I provide it with (x,y,z). It uses Delaunay triangulation, and is part of the standard MATLAB distribution (more about it here: http://www.mathworks.com/access/helpdesk/help/techdoc/ref/griddata.html#1007265). My question is whether anyone has come across its implementation in python. I could not find any information in any of the "standard" math packages. How do people do this? Thanks, Peter |