I inadvertently discovered the algorithm for plotting a right-facing slanted cladogram this evening. Basically, to get the vertical position of each internal node we just assign heights 1 through N to the tips; and then each internal node is merely the simple arithmetic mean of its descendants. We get the horizontal positions (the heights above the root) using the method of Grafen with ρ=1, implemented in the ape function compute.brlen.
We can apply this algorithm via the phytools function phenogram as follows:
plotCladogram<-function(tree){
foo<-function(tree,x){
n<-1:tree$Nnode+length(tree$tip.label)
setNames(sapply(n,function(n,x,t) mean(x[Descendants(t,n,
"tips")[[1]]]),x=x,t=tree),n)
}
tree<-reorder(tree,"cladewise")
x<-setNames(1:length(tree$tip.label),tree$tip.label)
phenogram(compute.brlen(tree),c(x,foo(tree,x)),ylab="")
}
foo<-function(tree,x){
n<-1:tree$Nnode+length(tree$tip.label)
setNames(sapply(n,function(n,x,t) mean(x[Descendants(t,n,
"tips")[[1]]]),x=x,t=tree),n)
}
tree<-reorder(tree,"cladewise")
x<-setNames(1:length(tree$tip.label),tree$tip.label)
phenogram(compute.brlen(tree),c(x,foo(tree,x)),ylab="")
}
For example:
> require(phytools)
> require(phangorn)
> tree<-pbtree(n=26,tip.label=LETTERS[26:1])
> plotCladogram(tree)
> require(phangorn)
> tree<-pbtree(n=26,tip.label=LETTERS[26:1])
> plotCladogram(tree)
Best Watches Singapore
ReplyDeleteBuy Watches In Dubai
Rolex Watches David M Robinson
Audemars Piguet Watches Singapore
Cartier Watch 7
Buy Watches Deep Web
Replica Watches 2836
Omega Watches Qatar
Fake Expensive Watches
Replica Watches Swiss Eta Movement Uk