[R] plot contour map for irregular data points
Andre Jung
ajung at gfz-potsdam.de
Thu Sep 13 09:52:44 CEST 2007
Yes, contourplot() takes irregular spaced values, but you need a regular
grid to project the data on to.
grid <- expand.grid(x=x,y=y);
contourplot(z~x*y,grid,cuts=50);
This gives me a plot with little coloured areas around my datapoints only.
A better way for me was to
library(akima);
data.interp <- interp(x,y,z);
image(data.interp); #or
contour(data.interp);
where interp() leaves you with multiple options of interpolation
(linear, spline, ...).
For further reading I recommend:
https://stat.ethz.ch/pipermail/r-help/2005-October/080853.html
https://stat.ethz.ch/pipermail/r-help/2003-December/043897.html
https://stat.ethz.ch/pipermail/r-sig-geo/2005-October/000609.html
cheers,
andre
S Ellison wrote:
> Doesn't the lattice package's contourplot take arbitrary x and y?
>
> library(lattice)
> ?contourplot
More information about the R-help
mailing list