Function plots a traitgram (Evans et al. 2009), that is, a projection of the phylogenetic tree in a space defined by phenotype (on the y axis) and time (on the x). If a discrete character is mapped on the tree this will also be plotted.
phenogram(tree, x, fsize=1.0, ftype="reg", colors=NULL, axes=list(),
add=FALSE, ...)
Plots a traitgram, optionally with a mapped discrete character, and (invisibly) returns a matrix containing the coordinates of the plotted tip labels.
an object of class "phylo"
, with or without a mapped discrete character.
a vector containing the states at the tips or the states at all the tips and the internal nodes of the tree.
relative font size for tip labels.
font type - options are "reg"
, "i"
(italics), "b"
(bold), or "bi"
(bold-italics).
colors for plotting the mapped character (if available) in tree
. If no character is mapped on the tree, then a single color for all the branches of the tree can be provided.
list of axis dimensions. Items are time
and trait
.
optional logical value indicating whether to add to an open plot. If TRUE
, then new axes will not be plotted.
optional arguments including xlim
, ylim
, log
, main
, sub
, xlab
, ylab
, asp
, type
, lty
, lwd
, offset
, and digits
are as in plot.default
or par
. Note that axes
overrides xlim
and ylim
. spread.labels
is a logical value indicating whether or not to minimize tip label overlap (default is TRUE
); spread.cost
is a numeric vector indicating the relative penalty to be used for label overlap and deviance, respectively (if spread.labels=TRUE
); spread.range
is the range over which to (potentially) spread the labels - note that if labels do not overlap, not all of that range will be used; finally, link
is a numeric value by which to offset the tip labels, linking them to the tips with a dashed line (default is 0
, if spread.labels=FALSE
, or 10-percent of the total tree length otherwise). The optional argument offsetFudge
"fudges" the computation of label offset in scaling xlim
. It is 1.37, which is the correct fudge in the Windows R GUI, but this may need to be changed in other systems. hold
indicates whether (or not) the output to the graphical device should be held using dev.hold
before plotting (defaults to hold=TRUE
). quiet
suppresses some system messages if set to quiet=TRUE
.
Liam Revell liam.revell@umb.edu
For spread.labels=TRUE
numerical optimization is performed to optimize the distribution of the labels vertically, where the solution depends on the vector spread.cost
containing the cost of overlap (first) and the cost of deviation from the vertical position of the tip. Note that because this is done via numerical optimization, plotting may hang briefly while the best solution is found (especially for large trees).
Evans, M. E. K., Smith, S. A., Flynn, R. S., Donoghue, M. J. (2009) Climate, niche evolution, and diversification of the "bird-cage" evening primroses (Oenothera, sections Anogra and Kleinia). American Naturalist, 173, 225-240.
Revell, L. J. (2012) phytools: An R package for phylogenetic comparative biology (and other things). Methods Ecol. Evol., 3, 217-223.
## load data from Garland et al. (1992)
data(mammal.tree)
data(mammal.data)
## extract character of interest
ln.bodyMass<-log(setNames(mammal.data$bodyMass,
rownames(mammal.data)))
## plot traitgram
phenogram(mammal.tree,ln.bodyMass,ftype="i",
spread.cost=c(1,0),fsize=0.7,xlab="time (ma)",
ylab="log(body mass)")
Run the code above in your browser using DataLab