PhyloSoC:Tree and data plotting demonstration

From Phyloinformatics
Jump to: navigation, search

This page is a guided tour through the new plotting interface for the phylobase package, developed as part of the Google Summer of Code mentored by NEScent. The following code and descriptions are based on the code at the end of the project, summer 2008. In the future some of the command names are arguments may change. The latest documentation can be found in the phylobase package itself.


As of late August a special branch of the phylobase project must be installed for the code on this page to work. The code can be retrieved and installed using the following commands on Mac OS X or Linux:

svn checkout svn://svn.r-forge.r-project.org/svnroot/phylobase/branches/pdcgsoc
R CMD INSTALL pdcgsoc/

In the near future this code will be merged into the main phylobase package and the above steps will not be necessary.

Click on any example plot to see the large version


Next load the package and plot the example data:

require(phylobase)
data(geospiza) 
treePlot(geospiza)
treePlot(geospiza)
treePlot(gEx)
tmp <- tdata(geospiza)
gEx <- geospiza
tdata(gEx) <- as.data.frame(scale(tmp))
treePlot(gEx)
treePlot(extree)


This could be made a bit more useful by scaling the trait data: The following code shows and example using randomly generated data, note that the values below zero are represented by filled bubbles.

set.seed(1)
extree <- as(rtree(20), 'phylo4')

tipdat <- matrix(rnorm(200), nrow = 20, ncol = 10)
row.names(tipdat) <- labels(extree)
extree <- phylo4d(extree, tip.data = as.data.frame(tipdat))
treePlot(extree)
treePlot(extree)