phylo.to.map: Plot tree with tips linked to geographic coordinates

View source: R/phylo.to.map.R

phylo.to.mapR Documentation

Plot tree with tips linked to geographic coordinates

Description

Project a phylogeny on a geographic map.

Usage

phylo.to.map(tree, coords, rotate=TRUE, ...)
## S3 method for class 'phylo.to.map'
plot(x, type=c("phylogram","direct"), ...)

Arguments

tree

an object of class "phylo".

coords

a matrix containing the latitude (in column 1) and the longitude of all tip species in the tree. The row names should be the same as tree$tip.label; however, more than one set of coordinates per species can be supplied by duplicating some row names.

rotate

a logical value indicating whether or not to rotate nodes of the tree to better match longitudinal positions.

x

for plot.phylo.to.map, an object of class "phylo.to.map".

type

a string indicating whether to map the tips of the tree onto a geographic map from a square phylogram (type="phylogram") or to project the tree directly onto the map (type="direct").

...

various optional arguments. For the function phylo.to.map, which first creates an object of the special class "phylo.to.map" and then (optionally) plots this object, arguments include: database and regions (see map), as well as any arguments that should be passed to plot.phylo.to.map internally. For phylo.to.map, optional arguments xlim and ylim, which control the plot area for the map; fsize for the font size of plot labels and ftype for the font type (following plotSimmap; split which controls the proportion of vertical (or horizontal) space for the tree (first) and map, in a vector; psize the size of the plotted points on the map - or cex.points, a vector contain the size of the tip points and geographic coordinate points, respectively; from.tip a logical value indicating whether to plot the linking lines from the tips (if TRUE) or from the end of the tip label, the default; colors, a single value or a vector of colors for the points and the linking lines; pch a single value or a vector of point types; lwd and lty for the linking lines; and pts a logical value indicating whether or not to plot points at the tips of the tree. mar and asp are as in par.

Details

phylo.to.map creates an object of class "phylo.to.map" and (optionally) plots that object.

plot.phylo.to.map plots an object of class "phylo.to.map" in which the tips of the tree point to coordinates on a geographic map.

Value

phylo.to.map creates an object of class "phylo.to.map" and (if plot=TRUE) plots a phylogeny projected onto a geographic map.

plot.phylo.to.map plots on object of class "phylo.to.map".

Author(s)

Liam Revell liam.revell@umb.edu

References

Revell, L. J. (2014) Graphical methods for visualizing comparative data on phylogenies. Chapter 4 in Modern phylogenetic comparative methods and their application in evolutionary biology: Concepts and practice (L. Z. Garamszegi ed.), pp. 77-103.

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

Examples

## generally recommend using higher resolution map
## e.g., from mapdata package
data(tortoise.tree)
data(tortoise.geog)
tortoise.phymap<-phylo.to.map(tortoise.tree,
  tortoise.geog,plot=FALSE,direction="rightwards",
  regions="Ecuador")
plot(tortoise.phymap,direction="rightwards",pts=FALSE,
  xlim=c(-92.25,-89.25),ylim=c(-1.8,0.75),ftype="i",
  fsize=0.8,lty="dashed",map.bg="lightgreen",
  colors="slategrey")
## reset margins
par(mar=c(5.1,4.1,4.1,2.1))

phytools documentation built on June 22, 2024, 10:39 a.m.