densityMap {phytools}R Documentation

Plot posterior density of stochastic mapping on a tree


Function plots a tree with the posterior density for a mapped character from stochastic character mapping on the tree. Since the mapped value is the probability of being in state "1", only binary [0,1] characters are allowed.


densityMap(trees, res=100, fsize=NULL, ftype=NULL, lwd=3, check=FALSE,
	legend=NULL, outline=FALSE, type="phylogram", direction="rightwards",
	plot=TRUE, ...)
## S3 method for class 'densityMap'
plot(x, ...)



set of phylogenetic trees in a modified "multiPhylo" object. Values for a two-state discrete character are mapped on the tree. See make.simmap and read.simmap for details.


resolution for gradient plotting. Larger numbers indicate a finer (smoother) gradient.


relative font size - can be a vector with the second element giving the font size for the legend.


font type - see options in plotSimmap. As with fsize, can be a vector with the second element giving font type for the legend.


line width for branches.


check to make sure that the topology and branch lengths of all phylogenies in trees are equal.


if FALSE no legend is plotted; if a numeric value, it gives the length of the legend in units of branch length. Default is 0.5 times the total tree length.


logical value indicating whether or not to outline the branches of the tree in black.


type of plot desired. Options are "phylogram" for a rightward square phylogram; and "fan" for a circular phylogram.


logical value indicating whether or not to plot the tree. If plot=FALSE then an object of class "densityMap" will be returned without plotting.


plotting direction for type="phylogram".


for plot.densityMap, an object of class "densityMap".


optional arguments for plot.densityMap. These include all the arguments of densityMap except trees and res. Additional optional arguments include mar (margins), offset (tip label offset), and hold (whether or not to use dev.hold to hold output to graphical device before plotting; defaults to hold=TRUE).


Plots a tree and returns an object of class "densityMap" invisibly.


Liam Revell


Bollback, J. P. 2006. Stochastic character mapping of discrete traits on phylogenies. BMC Bioinformatics, 7, 88.

Huelsenbeck, J. P., R. Neilsen, and J. P. Bollback. 2003. Stochastic mapping of morphological characters. Systematic Biology, 52, 131-138.

Revell, L. J. (2012) phytools: An R package for phylogenetic comparative biology (and other things). Methods Ecol. Evol., 3, 217-223.

Revell, L. J. 2013. Two new graphical methods for mapping trait evolution on phylogenies. Methods in Ecology and Evolution, 4, 754-759.

See Also

make.simmap, plotSimmap, read.simmap

[Package phytools version 0.4-60 Index]