brace: Create a brace for a graph

Description Usage Arguments Value Author(s) See Also Examples

Description

The function brace() calculates the (X,Y) coordinates to draw a brace between two points in a graph.

Usage

1
brace(x1 = 0, y1 = 0, x2 = 0, y2 = 1, right = TRUE, rad = 0.2)

Arguments

x1, y1

Coordinate of the initial point for the brace

x2, y2

Coordinate of the final point for the brace

right

Logical to indicate if a vertical brace should have its' central point facing right. If the brace is horizontal (y1 == y2), "right" means "down"

rad

Radius of the quarter circles used to draw the brace

Value

A 2-column matrix of (X,Y) points, suitable for use with lines

Author(s)

Georges Monette, modified for R by Michael Friendly

See Also

lines, arrows, ~~~

Examples

1
2
3
4
5
6
7
8
9
plot(c(-1,1), c(-1,1), type="n", xlab="x", ylab="y")
abline(h=0, col="gray")
abline(v=0, col="gray")
b <- 0.6
abline(0, b, col="blue")
lines(brace(0, 0, 0, b, right=FALSE, rad=0.1))
lines(brace(0, 0, 1, 0, rad=0.1))
text(0.5, -.2, '1', cex=2)
text(-.2, b/2, 'b', cex=2)

gmonette/spida documentation built on May 17, 2019, 7:25 a.m.