Learn R Programming

shotGroups (version 0.2-2)

drawEllipse: Draw a single ellipse

Description

Adds a single ellipse to an already opened plot.

Usage

drawEllipse(ctr, shape, radius, nv = 100, fg = par('fg'),
            bg = NA, colCtr = NA, lty = par('lty'),
            lwd = par('lwd'), pch = par('pch'), cex = par('cex'))

Arguments

ctr
a numerical 2-vector giving the (x,y)-coordinates of the center.
shape
a numerical symmetric (2 x 2)-matrix whose eigen-structure determines the ellipse's shape.
radius
a numerical value giving the ellipse's magnification factor.
nv
number of vertices in the approximating polygon.
fg
color of the ellipse's rim.
bg
the ellipse's fill color. Set to NA for a fully transparent ellipse.
colCtr
color of the center point. Set to NA to omit.
lty
line type of the ellipse.
lwd
line width of the ellipse.
pch
symbol used for the center of the ellipse.
cex
magnification factor for the symbol used for the center of the ellipse.

Details

This function is mainly a wrapper for polygon.

See Also

polygon

Examples

Run this code
## error ellipse for a set of points
xy     <- matrix(round(rnorm(100, 0, 8), 2), ncol=2)
ctr    <- colMeans(xy)
covMat <- cov(xy)
plot(xy, pch=16, asp=1)
drawEllipse(ctr, covMat, radius=1, fg='blue', colCtr='blue',
            lwd=2, pch=4, cex=2)

Run the code above in your browser using DataLab