Learn R Programming

phytools (version 2.1-1)

geo.legend: Adds a geological (or other temporal) legend to a plotted tree

Description

Adds a geological legend to a plotted tree.

Usage

geo.legend(leg=NULL, colors=NULL, alpha=0.2, ...)
geo.palette()

Value

geo.legend adds a visual element to a plotted tree and invisible returns an object of class geo.legend containing the time periods and colors of the painted legend.

geo.palette simply returns a geological timescale color palette as an object of class "geo.palette".

Arguments

leg

a matrix with the starting & ending point of each plotted era in rows, & names of the time periods as rownames.

colors

a vector of colors for the time periods of the rows in leg.

alpha

transparency level to apply to colors.

...

optional arguments.

Author

Liam Revell liam.revell@umb.edu

Details

The function geo.legend adds a geological (or other temporal) legend to a plotted tree.

The function geo.palette returns a geological time color palette to the user.

References

Revell, L. J. (2024) phytools 2.0: an updated R ecosystem for phylogenetic comparative methods (and other things). PeerJ, 12, e16505.

Examples

Run this code
data(anoletree)
## rescale tree to 50 ma total depth
anoletree<-rescale(anoletree,model="depth",depth=50)
## plot phylogeny
plotTree(anoletree,ylim=c(-0.16,1)*Ntip(anoletree),
  ftype="i",lwd=1,fsize=0.5)
## add geological color legend
obj<-geo.legend()
par(mar=c(5.1,4.1,4.1,2.1))

Run the code above in your browser using DataLab