PlotCharacterMapping: Plot character mapping

PlotCharacterMappingR Documentation

Plot character mapping

Description

Plot a tree depicting a character reconstruction

Usage

PlotCharacterMapping(
  char,
  stateLabels,
  singleTree,
  legendText = "",
  SetPar = par(mar = rep(0.2, 4), cex = 0.7),
  canvas = NULL,
  treeNames = NULL,
  analysisLabels = canvas$analysisNames,
  charIndex = character(0),
  svgFilename = "tree_%s.svg"
)

Arguments

char

Character vector specifying distribution of tokens among (named) taxa

stateLabels

Character vector specifying the labels to apply to each state

singleTree

A single tree to be plotted in Latex output

legendText

Character giving legend text to print in Latex output

SetPar

Graphical parameters to set before plotting PNG tree in Latex output. Specify NULL to retain existing parameters.

canvas

an object of class SVGForest.

treeNames

Character string naming the analysis used to generate each tree

analysisLabels

Character vector specifying names of each analysis, to be printed on plot

charIndex

Character vector providing a reference for the character, typically its number, to be sent to SVGTree()

svgFilename

Character string specifying location to save each file, containing the expression %s, which will be replaced with the number of the tree.

Details

This function will plot a reconstruction of the distribution of character char on a set of phylogenetic trees. The function is intended for use in R Markdown (.Rmd) documents, which might be rendered using the knitr, rmarkdown or bookdown pacakges. These packages can produce output in PDF or HTML format; this package will generate SVG files for HTML output, and a static PNG otherwise.

The SVG output will generate a separate plot for each tree in canvas; JavaScript can be specified using PrintSwitcher() or PrintJavascript() in order to allow the user to switch between trees. Due to the space considerations implicit in PDF documents, the PNG images include only a single tree, specified by singleTree.

HTML output can be forced by setting options('localInstance' = TRUE).

Value

Prints the tree in an appropriate markdown format

Author(s)

Martin R. Smith

Examples

  # An example is given in the help page for SVGCanvas; type ?SVGCanvas

TGuillerme/Inapp documentation built on Feb. 4, 2024, 7:26 a.m.