https://github.com/cran/fields
Raw File
Tip revision: 6769ffc81115fbf0bf7d9c566cf7ac81be0049dc authored by Doug Nychka on 25 July 2005, 00:00:00 UTC
version 3.04
Tip revision: 6769ffc
quilt.plot.R
"quilt.plot" <-
function(x,y,z,nrow=64, ncol=64, grid=NULL, add.legend=TRUE,...){

x<- as.matrix(x)


  if( ncol(x)==2){
   z<- y}

  if( ncol(x)==1){
   x<- cbind( x,y)}
  if( ncol(x)==3){
  z<- x[,3]
  x<- x[,1:2]
}

# at this point x should be a 2 column matrix of x-y locations
#  z is a vector or one column matrix of the z values.

#discretize data
as.image( z, x=x, nrow=nrow, ncol=ncol, na.rm=TRUE)-> out.p

#plot it 
if( add.legend){
image.plot( out.p,col=tim.colors(64),...)
}
else{
image(out.p, col=tim.colors(64),...)
}


}

back to top