Learn R Programming

shotGroups (version 0.8.2)

drawEllipse: Draw an ellipse

Description

Adds an ellipse to an existing plot.

Usage

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

# S3 method for list drawEllipse(x, shape, radius, nv = 100, axes = FALSE, fg = par('fg'), bg = NA, colCtr = NA, lty = par('lty'), lwd = par('lwd'), pch = par('pch'), cex = par('cex'))

# S3 method for default drawEllipse(x, shape, radius, nv = 100, axes = FALSE, fg = par('fg'), bg = NA, colCtr = NA, lty = par('lty'), lwd = par('lwd'), pch = par('pch'), cex = par('cex'))

Arguments

x

either a numerical 2-vector giving the (x,y)-coordinates of the center or a list with the components ctr, cov and magFac as returned by getConfEll or getMinEllipse.

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.

axes

logical: should ellipse axes be drawn?

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, getConfEll, getMinEllipse

Examples

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

Run the code above in your browser using DataLab