User:Daniel Mietchen/Notebook/Evolutionary MRI/2010/04/29
Evolutionary MRI | <html><img src="/images/9/94/Report.png" border="0" /></html> Main project page <html><img src="/images/c/c3/Resultset_previous.png" border="0" /></html>Previous entry<html> </html>Next entry<html><img src="/images/5/5c/Resultset_next.png" border="0" /></html> |
Primate PhylogenyCarl Boettiger 00:37, 30 April 2010 (EDT):
R code to create figure<syntaxhighlight lang="rsplus"> library(ape) library(geiger) genera_set <- read.nexus("mt.genera.ucld.trees") nuc_set <- read.nexus("nuc.ucld.trees") genera <- genera_set1 nuc <- nuc_set1 nuc_names <- nuc$tip.label genera_names <- genera$tip.label traits <- read.csv("Primate_brain_comparisons.csv") dups <- duplicated(traits'Genus') trait_names <- as.character(traits$Genus[!dups]) x <- traits$log_brain.weight[!dups] names(x) <- trait_names
plot_cts_ancestor <- function(phy, data, ancestral){ plot(phy) # just to get treelength treelen <- max(axisPhylo() ) plot(compare$phy, cex=1, x.lim=1.3*treelen, edge.width=2) mycol <- function(x){ tmp = (x - min(data)) /max(x-min(data)) rgb(blue = 1-tmp, green=0, red = tmp ) } nodelabels(pch=19, col=mycol(ancestral$ace), cex=1.5 ) tiplabels(pch=19, col=mycol(data), cex=1.5, adj=0.5) # add tip color code } plot_cts_ancestor(compare$phy, compare$data, out) </syntaxhighlight>
Code and data on GithubNew github repository for sharing code and data: sandbox
git clone git://github.com/cboettig/sandbox.git
git checkout 77af6613db294ca068cf
git checkout b1a90ad97b90d9cbeaa7
|