I recently received the following question:
"Would it be possible in contMap to specify our own color ramp instead of stuck with the default red-to-blue?"
This cannot yet be done automatically, but it is not too hard. Here are a couple of examples. Note that they also apply equally to objects created using densityMap.
> ## first create simulated tree & data
> tree<-pbtree(n=26,tip.label=LETTERS[26:1])
> x<-fastBM(tree)
> ## build object of class "contMap"
> obj<-contMap(tree,x,plot=FALSE)
> obj
Object of class "contMap" containing:
(1) A phylogenetic tree with 26 tips and 25 internal nodes.
(2) A mapped continuous trait on the range (-4.458, 2.5).
> ## default colors
> plot(obj)
> tree<-pbtree(n=26,tip.label=LETTERS[26:1])
> x<-fastBM(tree)
> ## build object of class "contMap"
> obj<-contMap(tree,x,plot=FALSE)
> obj
Object of class "contMap" containing:
(1) A phylogenetic tree with 26 tips and 25 internal nodes.
(2) A mapped continuous trait on the range (-4.458, 2.5).
> ## default colors
> plot(obj)
> ## what is the length of the current color ramp?
> n<-length(obj$cols)
> ## change to grey scale
> obj$cols[1:n]<-grey(0:(n-1)/(n-1))
> plot(obj)
> n<-length(obj$cols)
> ## change to grey scale
> obj$cols[1:n]<-grey(0:(n-1)/(n-1))
> plot(obj)
> ## change to blue -> red
> obj$cols[1:n]<-colorRampPalette(c("blue","red"), space="Lab")(n)
> plot(obj)
> obj$cols[1:n]<-colorRampPalette(c("blue","red"), space="Lab")(n)
> plot(obj)
That's it!