a preliminary version of a new function to phytools for plotting a
“phylogenetic heat map.” This visualization is roughly akin to the R stats
heatmap: although instead of plotting a dendrogram next
to the plotted data, it plots an input tree. This was something requested of
me by a colleague Nate Swenson
some time ago, but unfortunately I didn't get around to trying it until today.
Here's a quick demo of how it works. To follow, one would have to install the latest version of phytools from GitHub:
Now, let's try it:
##  '0.5.13'
## simulate a tree & some data tree<-pbtree(n=26,tip.label=LETTERS[26:1]) X<-fastBM(tree,nsim=12) phylo.heatmap(tree,X)
A few different attributes can be customized about the plot, and I'm open to making it more flexible if there is interest. For instance, it is quite straitforward to change the palette:
## terrain colors phylo.heatmap(tree,X,colors=terrain.colors(20))
## interpolated blue->red colors<-colorRampPalette(colors=c("blue","red"))(100) phylo.heatmap(tree,X,colors=colors)
It also works & looks pretty good for non-ultrametric trees:
tree<-rtree(n=40) X<-fastBM(tree,nsim=20) colnames(X)<-paste("trait",1:20) phylo.heatmap(tree,X,fsize=c(0.8,0.8,1))
That's it for now.