RE: [R] Fitting Contour to Data Points

From: Liaw, Andy <andy_liaw_at_merck.com>
Date: Mon 16 May 2005 - 21:59:08 EST


You can use the akima package to interpolate to a regular grid, then plot that. Another choice is to fit a smooth surface, using any number of smoothers available in R and CRAN.

Andy

> From: Laura Quinn
>
> Apologies for the mass mailing today!
>
> I am attempting to produce a contour plot for phsical data on a map
> matrix. I have a small number of data points which each has an (x,y)
> co-ordinate together with a corresponding value which I would like to
> cvreate a contour plot for.
>
> I have tried the following code:
>
> contour(data$x,data$y,data$value)
>
> but am told:
>
> Error in contour.default(data$x, data$y, data$value) :
> increasing x and y values expected
>
> I have re-ordered the matrix so that the x values are increasing, but
> these do not necessarrily correspond with increasing y values
> (as this is
> not a regular grid)...can anyone offer a way around this??
>
> Laura Quinn
> Institute of Atmospheric Science
> School of Earth and Environment
> University of Leeds
> Leeds
> LS2 9JT
>
> tel: +44 113 343 1596
> fax: +44 113 343 6716
> mail: laura@env.leeds.ac.uk
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
>
>
>



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Mon May 16 22:06:43 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:31:46 EST