
Plot posterior probabilities of states/ranges on phylogeny from densityMaps
Source:R/plot_densityMaps_overlay.R
plot_densityMaps_overlay.RdPlot on a time-calibrated phylogeny the evolution of a categorical trait/biogeographic ranges
summarized from densityMaps typically generated with prepare_trait_data().
Each branch is colored according to the posterior probability of being in a given state/range.
Color for each state/range are overlaid using transparency to produce a single plot for all states/ranges.
Usage
plot_densityMaps_overlay(
densityMaps,
colors_per_levels = NULL,
add_ACE_pies = TRUE,
cex_pies = 0.5,
ace = NULL,
...,
display_plot = TRUE,
PDF_file_path = NULL
)Arguments
- densityMaps
List of objects of class
"densityMap", typically generated withprepare_trait_data(), that contains a phylogenetic tree and associated posterior probability of being in a given state/range along branches. Each object (i.e.,densityMap) corresponds to a state/range. If no color is provided for multi-area ranges, they will be interpolated.- colors_per_levels
Named character string. To set the colors to use to map each state/range posterior probabilities. Names = states/ranges; values = colors. If
NULL(default), the color scale provideddensityMapswill be used.- add_ACE_pies
Logical. Whether to add pies of posterior probabilities of states/ranges at internal nodes on the mapped phylogeny. Default =
TRUE.- cex_pies
Numerical. To adjust the size of the ACE pies. Default =
0.5.- ace
Numerical matrix. To provide the posterior probabilities of ancestral states/ranges (characters) estimates (ACE) at internal nodes used to plot the ACE pies. Rows are internal nodes. Columns are states/ranges. Values are posterior probabilities of each state per node. Typically generated with
prepare_trait_data()in the$aceslot. IfNULL(default), the ACE are extracted from thedensityMapswith a possible slight discrepancy with the actual tip states and estimated posterior probabilities of ancestral states.- ...
Additional arguments to pass down to
phytools::plotSimmap()to control plotting.- display_plot
Logical. Whether to display the plot generated in the R console. Default is
TRUE.- PDF_file_path
Character string. If provided, the plot will be saved in a PDF file following the path provided here. The path must end with ".pdf".
Value
If display_plot = TRUE, the function plots a time-calibrated phylogeny displaying the evolution of a categorical trait/biogeographic ranges.
If PDF_file_path is provided, the function exports the plot into a PDF file.
Author
Maël Doré
Original functions by Liam Revell in R package phytools. Contact: liam.revell@umb.edu