2 min read

Week08 - Interactive Phylogeny

Week08 - Interactive Phylogeny

htmlwidgets News This Week

-@HarlanH - c3 htmlwidget c3r. c3 is a really nice reusable d3.js charting library that will make for a very powerful htmlwidget. Be sure to check out the c3.js demo and all of the examples.

-@yutannihilation - two more from this prolific htmlwidget-er

  1. highstockR provides a htmlwidget for Highstock, but be careful of Highcharts licensing.
  2. dcStockR will attempt to do what has baffled me for a long time which is to build a htmlwidget for dc.js. I hope he can pull it off.

This Week’s Widget - treewidget | Interactive Phylogeny + Tree

Once again, this week I can only claim contributions, and most of the credit goes to sdwfrost and Hackout2 on the R side. For the all important JavaScript, we can thank Sergei Pond and Steven Weaver from UCSD Viral Evolution Group for some brilliant work on phylotree.js. I mentioned in this post Week03 | More Network Layouts that a phylogeny viewer has been the most requested htmlwidget on Github and Twitter. As a nice coincidence, I spotted on Github the beginning of this widget and consequently discovered phylotree.js. Now I know nothing about phylogeny, but I couldn’t resist getting this thing to work. What I have since discovered is that this little beauty works well for hclust and dendrograms also.


Since it was designed for phylogeny, let’s start with an example in this field. We can use “some cytochrome b sequences” data on some North American snakes from this example from @kueda. I highly encourage you to click on nodes, reroot, tag, and just play a lot with this widget to see all that it offers.

# devtools::install("sdwfrost/epiwidgets")



You might have noticed that the Newick was used in this example. treewidget also accepts phylo data from the ape package. Let’s have a look using ?ape::bird.orders.


I enjoy the phylogeny stuff, but in finance, I don’t think I have ever encountered a phylogenetic tree. I don’t want anyone to feel left out. With the magic of ?ape::as.phylo, we can use this really powerful interactivity on hclust and dendrograms. Let’s use the ?hclust example.

  as.phylo(hclust(dist(USArrests), "ave"))


Thanks so much for all the work by