/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

  1. plot.K.through.time <-
  2. function(phy, traits, outfile=NULL){
  3. if(!is.null(outfile)){
  4. pdf(outfile)
  5. }
  6. if(ncol(traits)>1)stop("Cannot plot more than a single trait at a time")
  7. as.data.frame(K.all.nodes(phy,traits,return.all=FALSE))->raw
  8. raw$bt=-raw$node.time
  9. plot(raw$blomberg.K~raw$bt,ylab="Blomberg's K",xlab="branching.time", main="Blomberg's K through time")
  10. if(!is.null(outfile)){
  11. dev.off()
  12. }
  13. }