--- roger koenker <roger at ysidro.econ.uiuc.edu> wrote:
On May 6, 2005, at 2:45 PM, Roger Bivand wrote:
On Fri, 6 May 2005, m p wrote:
Hello, I'd like to make a z(x,y) plot for irregularly
spaced
x,y. What are routines are available in R for
this
purpose?
One possibility is to interpolate a regular grid
using interp() in the
akima package, then use image() or contour().
Another is to use
levelplot() with formula z ~ x + y in the lattice
package, and the
equivalent contourplot(); here, the x,y pairs must
lie on a grid,
but do not need to fill the grid (so are regularly spaced
with missing grid
cells).
You could also try tripack and rgl.triangles to produce piecewise linear surfaces on the Delaunay triangulation of the x,y points.
Or perhaps try gridding first using one of the kriging packages. It is just a little thing, but the method you decide to use is dependent on how you intend to use/represent the result ;O). Then there is the need for judgement, and then judgement, and oh, yes, more judgement. Density of points, clustering, blah, blah,... . Why do I say this? My experience with data if this nature is that you really do have to be careful or you may have yourself and others interpreting artifacts. If you are at the beginning of getting involved in some serious application(s) and time investment, you should explore the 'art and craft' of estimation....curl up with a nice geostatistics book, usw. That is, there is more to it than finding a package in R. If it is a 'once-over' with tame data, who cares? huh? Good luck and enjoy... Michael Grant Stay connected, organized, and protected. Take the tour: