% Generated by roxygen2: do not edit by hand % Please edit documentation in R/plot.algorithm.R \name{plot.states.matrix} \alias{plot.states.matrix} \title{Plot tree and ancestral states} \usage{ \method{plot}{states.matrix}(x, passes = c(1, 2, 3, 4), show.labels = 0, col.tips.nodes = c("#fc8d59", "#eeeeeed0", "#7fbf7be0", "#af8dc3e0"), counts = 0, use.edge.length = FALSE, col.states = FALSE, state.labels = character(0), legend.pos = "bottomleft", y.lim = NULL, ...) } \arguments{ \item{x}{A \code{states.matrix} list from \code{\link{apply.reconstruction}}} \item{passes}{\code{numeric}, the number of passes to plot (default = \code{c(1,2,3,4)}). Set to 0 to leave nodes unlabelled.} \item{show.labels}{\code{numeric}, either \code{1} for showing the tip labels, \code{2} for the node labels or \code{c(1,2)} for both (default = \code{NULL}).} \item{col.tips.nodes}{\code{character}, a vector of up to four colors to be used for displaying respectively the tips, the nodes, and (if \code{counts != 0}) the activated/counted nodes and the nodes at which regions are counted.} \item{counts}{\code{numeric}, whether to display the activations (\code{1}) or/and the homoplasies (\code{2}) or nothing (\code{0}; default).} \item{use.edge.length}{\code{logical} indicating whether to use the edge lengths of the phylogeny to draw the branches or not (default).} \item{col.states}{\code{logical}, whether to colour the states of the tips (\code{TRUE}) or not (\code{FALSE}, default).} \item{state.labels}{vector of mode \code{character} containing labels for each state of the character, in order, to be plotted if col.states is \code{TRUE}.} \item{legend.pos}{\code{character}, where to position the legend -- e.g. \code{bottomleft}. Sent as \code{x} parameter to \code{\link{legend}}. Specify \code{none} to hide the legend.`} \item{y.lim}{\code{numeric} \emph{x} and \emph{y} coordinates for limits of the plot, calculated automatically based on presence of legend if set to \code{NULL} (the default).} \item{\dots}{any optional arguments to be passed to \code{\link[ape]{plot.phylo}}} } \description{ Plots an ancestral states reconstruction and tree score } \examples{ ## A balanced 12 taxa tree tree <- ape::read.tree( text = "((((((1,2),3),4),5),6),(7,(8,(9,(10,(11,12))))));") ## A character with inapplicable data character <- "23--1??--032" ## NA algorithm NA_matrix <- apply.reconstruction(tree, character, passes = 4, method = "NA") ## Plotting the tree and the states plot(NA_matrix) ## Plotting the tree and the states with the state changes and regions plot(NA_matrix, counts = c(1,2)) ## Plot the tree with tip/node labels, and only the 1st and 2nd downpass plot(NA_matrix, passes = c(1,3), show.labels = c(1,2)) ## Plot the tree only the 2nd uppass with the state changes in green plot(NA_matrix, show.labels = 2, col.tips.nodes = c("red", "pink", "green"), counts = c(1,2), passes = c(3,4)) } \seealso{ \code{\link{apply.reconstruction}}, \code{\link{runInapp}} } \author{ Thomas Guillerme, Martin R. Smith }