add.arrow | R Documentation |
Adds an arrow or a set of arrows to a plotted tree.
add.arrow(tree=NULL, tip, ...)
tree |
an object of class |
tip |
label of tip or tip or node number; or vector of such values. If |
... |
optional arguments to control the shape and size of the arrow including: its length ( |
Trees can be plotted using phytools function plotTree
, plotSimmap
, contMap
, densityMap
, and ape S3 method plot.phylo
.
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.
nodelabels
## show arrows with a black outline
data(anoletree)
plotTree(anoletree,type="fan",fsize=0.7,ftype="i")
add.arrow(anoletree,tip=c("cuvieri","krugi",
"pulchellus","poncensis","stratulus",
"evermanni","cooki","cristatellus",
"gundlachi","occultus"),lwd=5,arrl=1)
add.arrow(anoletree,tip="cuvieri",col="green",
lwd=3,arrl=1)
add.arrow(anoletree,tip=c("krugi","pulchellus",
"poncensis"),col="#E4D96F",lwd=3,arrl=1)
add.arrow(anoletree,tip=c("stratulus","evermanni"),
col="darkgreen",lwd=3,arrl=1)
add.arrow(anoletree,tip=c("cooki","cristatellus",
"gundlachi"),col="brown",lwd=3,arrl=1)
add.arrow(anoletree,tip="occultus",col="darkgrey",
lwd=3,arrl=1)
legend(x="topleft",c("crown-giant","grass-bush","trunk-crown","trunk-ground",
"twig"),pch=22,pt.bg=c("green","#E4D96F","darkgreen",
"brown","darkgrey"),cex=0.9,
pt.cex=2,title="PR ecomorphs",bty="n")
par(mar=c(5.1,4.1,4.1,2.1)) ## reset margins to default
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.