addSNPScale: Add a SNP scale to phylogeny

Description Usage Arguments Examples

View source: R/addSNPScale.R

Description

Function that adds a SNP scale onto a plotted phylogeny

Usage

1
2
3
4
5
6
7
8
9
addSNPScale(
  x = NULL,
  y = NULL,
  position = NULL,
  size = 1,
  lineWidth = 1,
  cex = 1,
  offset = 0.5
)

Arguments

x

An optional numeric X coordinate for the scale

y

An optional numeric Y coordinate for the scale

lineWidth

A numeric scaling factor to change the width of the scale line. Defaults to 1. Equivalent to lwd

cex

A numeric scaling factor to chancge the size of the scale label. Defaults to 1.

offset

This value controls the distance (‘offset’) of the text label from the scale in fractions of a character width. Defaults to 0.5.

postion

An optional character vector detailing the location of the plot (top, middle, left, right, etc.)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
# Set the plotting margins
par(mar=c(0,0,0,0))

# Set the seed
set.seed(76263)

# Create a random phylogeny
tree <- ape::rtree(n=50, rooted=TRUE)

# Rescale the branch lengths to simulate SNPs
tree$edge.length <- round(tree$edge.length*10, digits=0)

# Plot the phylogeny
ape::plot.phylo(tree)

# Add a SNP scale
addSNPScale(position="bottomright", size=5)

JosephCrispell/phyloHelpeR documentation built on April 7, 2020, 8:28 a.m.