add.scale.bar: Add a Scale Bar to a Phylogeny Plot

Description Usage Arguments Details Author(s) See Also Examples

View source: R/scales.R

Description

This function adds a horizontal bar giving the scale of the branch lengths to a plot of a phylogenetic tree on the current graphical device.

Usage

1
2
add.scale.bar(x, y, length = NULL, ask = FALSE,
              lwd = 1, lcol = "black", ...)

Arguments

x

x location of the bar (can be left missing).

y

y location of the bar (can be left missing).

length

a numeric value giving the length of the scale bar. If none is supplied, a value is calculated from the data.

ask

a logical; if TRUE the user is asked to click where to draw the bar. The default is FALSE.

lwd

the width of the bar.

lcol

the colour of the bar (use col for the colour of the text).

...

further arguments to be passed to text.

Details

By default, the bar is placed in a corner of the graph depending on the direction of the tree. Otherwise both x and y must be specified (if only one is given it is ignored).

The further arguments (...) are used to format the text. They may be font, cex, col, and so on (see examples below, and the help page on text).

The function locator may be used to determine the x and y arguments.

Author(s)

Emmanuel Paradis

See Also

plot.phylo, axisPhylo, locator

Examples

1
2
3
4
5
6
7
tr <- rtree(10)
layout(matrix(1:2, 2, 1))
plot(tr)
add.scale.bar()
plot(tr)
add.scale.bar(cex = 0.7, font = 2, col = "red")
layout(1)

Example output



ape documentation built on Sept. 24, 2018, 9:03 a.m.