col.persp <-
function(z, colfun, ncol=12, colcoe=1,
colrange=range(z, na.rm=T),...){
#require(RColorBrewer)
if(class(colfun)!="function")
stop("A color scheme function is needed for col.persp3d, such as
topo.colors, or brewer.pal")
ncolor <- ncol
funmatch <- match.fun(colfun)
couleurs <- tail(funmatch(trunc(colcoe* ncolor), ...), ncolor)
zlim <- colrange
nrz <- nrow(z)
ncz <- ncol(z)
col <- couleurs[trunc((z-zlim[1])/(zlim[2]-zlim[1])*(ncol-1))+1]
fcol <- col
dim(fcol) <- c(nrz,ncz) #make fcol2 the corresponding matrix
fcol <- fcol[-nrz,-ncz] #get rid of the last row and the last column;
return(fcol)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.