#------------------------------------------------------------------------------------------#
# Function that creates a purple to green colour scheme. #
#------------------------------------------------------------------------------------------#
clife <<- function(n){
purple = c("#DEDEFF","#B7AFE3","#AA80FF","#8C41D8","#5A009A")
green = c("#EFFFCF","#C1E573","#89CC14","#4E7F0D","#254400")
nodes = c(rev(purple),green)
nodes = data.frame(t(col2rgb(nodes)))
pivot = round(seq(from=1,to=n,length.out=nrow(nodes)),digits=0)
rgb.out = data.frame(t(mapply(FUN=spline,y=nodes,MoreArgs=list(x=pivot,n=n))))$y
rgb.out = lapply(X=rgb.out,FUN=as.integer)
rgb.out = lapply(X=rgb.out,FUN=pmax, 0)
rgb.out = lapply(X=rgb.out,FUN=pmin,255)
rgb.out = rgb(r=rgb.out$red,g=rgb.out$green,b=rgb.out$blue,maxColorValue=255)
return(rgb.out)
}#end function clife
#------------------------------------------------------------------------------------------#
#------------------------------------------------------------------------------------------#
# Function that creates a nice colour scheme. #
#------------------------------------------------------------------------------------------#
iclife <<- function(n){
rgb.out = rev(clife(n=n))
return(rgb.out)
}#end function iclife
#------------------------------------------------------------------------------------------#
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.