Visualizing Phylogenetic Trees with R and jsPhyloSVG

December 7, 2017

(This article was first published on Posts on GGVY, and kindly contributed to R-bloggers)

During the last year I’ve been working on a daily basis with phylogenetic trees, objects that in graph jargon are called Directed Acyclic Graphs. While R does have some cool packages out there to visualize these–including phylocanvas which looks great!–I wanted to tryout jsPhyloSVG, and moreover, to learn how to use htmlwidgets.

So, after a week-long process of playing with JavaScript, of which I had no prior knowledge (so thank you W3shools)!, and hours of head-scratching, I created this R package, jsPhyloSVG that provides an htmlwidget for the library of the same name. An example follows

# I'll be using the ape package to simulate a tree
# You can get it from github USCBiostats/jsPhyloSVG

# A random phylogenetic tree with 50 tips
tree <- rtree(50)


You can take a look at the project repo here.

To leave a comment for the author, please follow the link and comment on their blog: Posts on GGVY. offers daily e-mail updates about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...

If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.

Search R-bloggers


Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)