Learn R Programming

frair (version 0.5)

drawpoly: Draw polygons

Description

Draw a closed polygon delineated by an 'upper' and 'lower' y limit.

Usage

drawpoly(x, upper, lower, ...)

Arguments

x
The x values of the polygon
upper
The upper 'edge' of the polygon
lower
The lower 'edge' of the polygon
...
Other arguments passed to polygon

Details

drawpoly is a generic method for drawing polygons where the polygon is drawn as:

polygon(x=c(x, rev(x), x[1]), y=c(upper, rev(lower), upper[1])

i.e. a line following along the top edge (left-to-right along x) and back along the bottom edge (right-to-left along x).

The specific method implemented here for FRAIR is drawpoly.frboot.

See Also

drawpoly.frboot

Examples

Run this code
datx <- 1:6
upper <- datx*1.2
lower <- datx*0.8
plot(datx, datx, type='n', ylim=c(0,10), xlab='X', ylab='Y')
drawpoly(datx, upper, lower, col=2)
points(datx, datx, pch=20)

Run the code above in your browser using DataLab