View source: R/backbonePhylo.R
plot.backbonePhylo | R Documentation |
Plots a backbone tree (stored as an object of class "backbonePhylo"
) with triangles as subtrees.
## S3 method for class 'backbonePhylo'
plot(x, ...)
x |
an object of class |
... |
optional arguments. Includes |
Plots a tree.
Liam Revell liam.revell@umb.edu
Revell, L. J. (2024) phytools 2.0: an updated R ecosystem for phylogenetic comparative methods (and other things). PeerJ, 12, e16505.
phylo.toBackbone
## first create our backbone tree with
## random subtree diversities
tree<-phytools:::lambdaTree(pbtree(n=10),lambda=0.5)
## create a translation table
## leaving a couple of single-taxon clades for fun
tip.label<-sample(tree$tip.label,8)
clade.label<-LETTERS[1:8]
N<-ceiling(runif(n=8,min=1,max=20))
## set crown node depth to 1/2 the maximum depth
depth<-sapply(tip.label,function(x,y)
0.5*y$edge.length[which(tree$edge[,2]==
which(y$tip.label==x))],y=tree)
trans<-data.frame(tip.label,clade.label,N,depth)
rownames(trans)<-NULL
## here's what trans looks like
print(trans)
## convert
obj<-phylo.toBackbone(tree,trans)
## plot
plot(obj)
par(mar=c(5.1,4.1,4.1,2.1)) ## reset par
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.