View source: R/PlotCharacter.R
PlotCharacter | R Documentation |
Reconstructs the distribution of a character on a tree topology using the modified Fitch algorithm presented in \insertCiteBrazeau2019;textualTreeSearch.
PlotCharacter(
tree,
dataset,
char = 1L,
updateTips = FALSE,
plot = TRUE,
tokenCol = NULL,
ambigCol = "grey",
inappCol = "lightgrey",
ambigLty = "dotted",
inappLty = "dashed",
plainLty = par("lty"),
tipOffset = 1,
unitEdge = FALSE,
Display = function(tree) tree,
...
)
## S3 method for class 'phylo'
PlotCharacter(
tree,
dataset,
char = 1L,
updateTips = FALSE,
plot = TRUE,
tokenCol = NULL,
ambigCol = "grey",
inappCol = "lightgrey",
ambigLty = "dotted",
inappLty = "dashed",
plainLty = par("lty"),
tipOffset = 1,
unitEdge = FALSE,
Display = function(tree) tree,
...
)
## S3 method for class 'multiPhylo'
PlotCharacter(
tree,
dataset,
char = 1L,
updateTips = FALSE,
plot = TRUE,
tokenCol = NULL,
ambigCol = "grey",
inappCol = "lightgrey",
ambigLty = "dotted",
inappLty = "dashed",
plainLty = par("lty"),
tipOffset = 1,
unitEdge = FALSE,
Display = function(tree) tree,
...
)
## S3 method for class 'list'
PlotCharacter(
tree,
dataset,
char = 1L,
updateTips = FALSE,
plot = TRUE,
tokenCol = NULL,
ambigCol = "grey",
inappCol = "lightgrey",
ambigLty = "dotted",
inappLty = "dashed",
plainLty = par("lty"),
tipOffset = 1,
unitEdge = FALSE,
Display = function(tree) tree,
...
)
tree |
A bifurcating tree of class |
dataset |
A phylogenetic data matrix of phangorn class
|
char |
Index of character to plot. |
updateTips |
Logical; if |
plot |
Logical specifying whether to plot the output. |
tokenCol |
Palette specifying colours to associate with each token in
turn, in the sequence listed in |
ambigCol , ambigLty , inappCol , inappLty , plainLty |
Colours and line types
to apply to ambiguous, inapplicable and applicable tokens. See the |
tipOffset |
Numeric: how much to offset tips from their labels. |
unitEdge |
Logical: Should all edges be plotted with a unit length? |
Display |
Function that takes argument |
... |
Further arguments to pass to |
PlotCharacter()
invisibly returns a matrix in which each row
corresponds to a numbered tip or node of tree
, and each column corresponds
to a token; the tokens that might parsimoniously be present at each point
on a tree are denoted with TRUE
.
If multiple trees are supplied, the strict consensus of all trees and
reconstructions will be returned; i.e. if a node is reconstructed as $0$
in one tree, and $2$ in another, it will be labelled $(02)$.
Martin R. Smith (martin.smith@durham.ac.uk)
# Set up plotting area
oPar <- par(mar = rep(0, 4))
tree <- ape::read.tree(text =
"((((((a, b), c), d), e), f), (g, (h, (i, (j, (k, l))))));")
## A character with inapplicable data
dataset <- TreeTools::StringToPhyDat("23--1??--032", tips = tree)
plotted <- PlotCharacter(tree, dataset)
plotted
# Character from a real dataset
data("Lobo", package = "TreeTools")
dataset <- Lobo.phy
tree <- TreeTools::NJTree(dataset)
PlotCharacter(tree, dataset, 14)
par(oPar)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.