https://github.com/cran/fields
Tip revision: 8f8fb01c96e0bd7cbf33a3c3066eb0cd7c8f1274 authored by Doug Nychka on 09 February 2006, 12:55:37 UTC
version 2.3
version 2.3
Tip revision: 8f8fb01
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)-> out.p
#plot it
if( add.legend){
image.plot( out.p,col=tim.colors(64),...)
}
else{
image(out.p, col=tim.colors(64),...)
}
}