[R] contour plot, failing to interpolate through all data

Dieter Menne dieter.menne at menne-biomed.de
Wed Nov 5 08:44:27 CET 2008


Folkes, Michael <Michael.Folkes <at> dfo-mpo.gc.ca> writes:

> I'm having trouble making contour lines for this attached, sparse
> dataset (low data:NA ratio!).  Is it the high number of NA's, or funny
> layout of the densities, or something else that's causing this?  
> 
> ####start data to be in file='testmatrix.csv'
> 
> "0.5","1","1.5","2","2.5","3"
> "-0.833",NA,NA,NA,NA,NA,21.05
> "-0.8",NA,NA,NA,NA,10.62,NA
> "-0.75",NA,NA,NA,5.13,NA,NA
> "-0.667",NA,NA,2.24,NA,NA,11.68

contour needs a more data, it's rather a plotting workhorse and not so good for
interpolation.
There are examples for spatial statistics in library/MASS/scripts/ch15.R and in
"the book" by Venables/Ripley. You might also search for "geo" in the packages,
because your problem is fairly common in geographical ecology.

Dieter



More information about the R-help mailing list