# function to plot special types of phylogeny visualizations # so far the only implemented type is "extinction" in which all branches leading to extinct taxa (or prior to the MRCA of extant species) # are plotted with red dashed lines # written by Liam J. Revell 2012 fancyTree<-function(tree,type="extinction"){ if(class(tree)!="phylo") warning("tree should be an object of class 'phylo'") edges<-rep(0,nrow(tree$edge)) names(edges)<-tree$edge[,2] extant<-getExtant(tree) ca<-findMRCA(tree,extant) root.node<-length(tree$tip)+1 if(ca!=root.node){ z<-setdiff(Descendants(tree,root.node,type="all"),Descendants(tree,ca,type="all")) edges[as.character(z)]<-1 } z<-Descendants(tree,ca,type="all") y<-Descendants(tree,z) for(i in 1:length(z)) if(!any(tree$tip.label[y[[i]]]%in%extant)) edges[as.character(z[i])]<-1 plot.phylo(tree,edge.color=edges+1,edge.lty=edges+1,edge.width=2,no.margin=TRUE) }