SVGCanvas | R Documentation |
Creates an object of class SVGCanvas
.
SVGCanvas(
trees,
outgroupTips = NULL,
analysisNames = character(0),
width = 682,
height = 682,
uniqueTrees = unique(trees),
xMargins = c(10L, 10L),
yMargins = c(10L, 10L),
textY = 3L
)
trees |
A list of trees, perhaps of class multiPhylo |
outgroupTips |
Character vector specifying tips to include in the
outgroup, to be sent to |
analysisNames |
Character vector of length |
width, height |
Numeric specifying the size of the plot in pixels |
uniqueTrees |
(optional) A list generated by unique(trees). Can be prepopulated to avoid time-intensive recalculation. |
xMargins, yMargins |
Numeric vectors of length 2 specifying, in pixels, the margin to be left at each side of the plot |
textY |
Numeric specifying how far to adjust the vertical position of text |
SVGCanvas
objects are used to visualize character reconstructions on
phylogenetic trees.
The vizualizations are rendered as SVG elements that can be saved
as stand-alone SVG files, or included in HTML documents.
If incorporated in an HTML vignette, Javascript and CSS can be used to style the output and enable users to interact with the visualizations.
An object of class SVGCanvas
Martin R. Smith
{
## Not run:
# Generate multiPhylo object containing four trees, with first and last identical:
trees <- structure(list(
ape::rtree(10, br=NULL),
ape::rtree(10, br=NULL),
ape::rtree(10, br=NULL),
NULL), class='multiPhylo')
trees[[4]] <- trees[[1]]
treesGeneratedBy <- c('rtree', 'rtree', 'rtree', 'duplication')
canvas <- SVGCanvas(trees=trees,
outgroupTips='t1',
analysisNames=treesGeneratedBy,
width=300, height=300)
PlotCharacterMapping(char = '0011----11',
stateLabels = c('Absent', 'Present'),
singleTree = trees[[1]],
legendText = 'This is printed on PNGs',
canvas = canvas,
svgFilename = 'tree_number_%s.svg')
## End(Not run)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.