/packages/archive/2010/04.2010/04.20.2010/spacodi/R/plot.K.through.time.R
http://github.com/eastman/spacodiR · R · 14 lines · 13 code · 1 blank · 0 comment · 3 complexity · 7e06cb2e26e28d73096212d75978fba0 MD5 · raw file
- plot.K.through.time <-
- function(phy, traits, outfile=NULL){
- if(!is.null(outfile)){
- pdf(outfile)
- }
- if(ncol(traits)>1)stop("Cannot plot more than a single trait at a time")
- as.data.frame(K.all.nodes(phy,traits,return.all=FALSE))->raw
- raw$bt=-raw$node.time
- plot(raw$blomberg.K~raw$bt,ylab="Blomberg's K",xlab="branching.time", main="Blomberg's K through time")
- if(!is.null(outfile)){
- dev.off()
- }
- }