Tuesday, May 17, 2011

A simple function for plotting phylogenies in ggplot2

UPDATE: Greg jordan has a much more elegant way of plotting trees with ggplot2. See his links in the comments below.

I wrote a simple function for plotting a phylogeny in ggplot2. However, it only handles a 3 species tree right now, as I haven't figured out how to generalize the approach to N species.

Any ideas on how to improve this?

1 comment:

  1. I implemented a ggplot-based tree plot function for the phylosim package: http://cran.r-project.org/web/packages/phylosim/vignettes/PhyloSim.pdf

    The examples don't show off the tree plotting so much, but here's an example of a plot that colors and scales lines using NHX annotations: http://www.ebi.ac.uk/~greg/scratch/NKX2-3_plot_tree.pdf

    Right now the plotting functions aren't too well documented, but feel free to get in touch if you'd like to see more.