Friday, June 24, 2016

Interactive version of phylo.toBackbone

I just created a new interactive version of the phytools function phylo.toBackbone, which creates a backbone phylogeny in which some clades are represented as triangles. This tree can then we plotted with an S3 plot method for the object class "backbonePhylo". Most of the code changes can be seen here. The updates are kind of hacky - principally because the original version of this appears to have been coded by me in 2013.

In previous versions of this function (e.g., 1, 2) the user had to supply the backbone tree as input along with a translation table. This is still possible, or course; however the current version allows the user to collapse clades into triangles by clicking on the fully plotted tree. This should be a nice feature for some users.

Obviously, interactive mode is kind of difficult to demonstrate - consequently I have embedded a screenshot video of a demo at the bottom. The following is just an illustration of the product. Remember for publication to save to PDF (or another line art format) to avoid aliasing, particularly on the edges of the triangles.

library(phytools)
packageVersion("phytools")
## [1] '0.5.38'
obj
## 
## Backbone phylogenetic tree with 15 subtrees and 14 resolved internal nodes.
## 
## Labels: t40, t10, t27, t13, t39, ...
## Diversities: 1, 1, 1, 1, 1, ...
plot(obj) ## defaults

plot of chunk unnamed-chunk-1

cols ## color some of the clades
##  Clade 1  Clade 2  Clade 4 
##  "black"    "red" "green3"
par(cex=0.8) ## change font size
par(font=3) ## change font type
plot(obj,col=cols,vscale=0.7)

plot of chunk unnamed-chunk-1

Here is the interactive demo:

2 comments: