This function is adapted from the ape function plot.phylo
used to plot phylogenetic trees.
The function can be used to plot simulated taxonomy along with the corresponding tree.
# S3 method for taxonomy
plot(
x,
tree,
show.mode = TRUE,
show.legend = TRUE,
legend.position = "bottomleft",
root.edge = TRUE,
hide.edge = FALSE,
edge.width = 1,
show.tip.label = FALSE,
align.tip.label = FALSE,
taxa.palette = "viridis",
cex = 1.2,
...
)
Taxonomy object.
Phylo object.
Indicate speciation mode.
Add a legend for the symbols indicating different speciation modes.
Position of the legend. Options include "bottomleft"
(default), "topleft"
, "bottomright"
, "topright"
or a vector of length 2 with x, y coordinates.
If TRUE include the root edge (default = TRUE).
If TRUE hide the root edge but still incorporate it into the automatic timescale (default = FALSE).
A numeric vector giving the width of the branches of the plotted phylogeny. These are taken to be in the same order as the component edge of tree
. If fewer widths are given than the number of edges, then the values are recycled.
Whether to show the tip labels on the phylogeny (defaults to FALSE).
A logical value or an integer. If TRUE, the tips are aligned and dotted lines are drawn between the tips of the tree and the labels. If an integer, the tips are aligned and this gives the type of the lines (lty).
Colour palette used for taxa. Colours are assigned to taxa using the function grDevices::hcl.colors()
and the default palette is "viridis". Other colour blind friendly palettes include "Blue-Red 3"
and "Green-Brown"
.
Numeric value giving the factor used to scale the points representing the fossils when show.fossils = TRUE
.
Additional parameters to be passed to plot.default
.
set.seed(123)
## simulate tree
t = TreeSim::sim.bd.taxa(8, 1, 1, 0.3)[[1]]
## simulate taxonomy
s = sim.taxonomy(t, 0.5, 1)
## plot the output
plot(s, t)
Run the code above in your browser using DataLab