shotGroups (version 0.1)

drawCircle: Draw a single circle

Description

Adds a single circle to an already opened plot.

Usage

drawCircle(x, y, radius, nv = 100, fg = par('fg'), bg = NA,
           colCtr = NA, lty = par('lty'), lwd = par('lwd'),
           pch = par('pch'), cex = par('cex'))

Arguments

x
a numerical value giving the center's x-coordinate.
y
a numerical value giving the center's y-coordinate.
radius
a numerical vector giving the circle's radius.
nv
number of vertices in the approximating polygon.
fg
color of the circle's rim.
bg
color of the circle's fill color. Set to NA for a fully transparent circle.
colCtr
color of the center point. Set to NA to omit.
lty
line type of the circle.
lwd
line width of the circle.
pch
symbol used for the center of the circle.
cex
magnification factor for symbol used for the center of the circle.

Details

This function is mainly a wrapper for polygon. To draw more than a few circles efficiently, use symbols instead.

See Also

polygon

Examples

Run this code
c1 <- c(1, 2)                 # circle center
c2 <- c(2, 3)                 # another circle center
r1 <- 2                       # circle radius
r2 <- 0.5                     # another circle radius

# determine axis limits so that circles will be visible
xLims <- c1[1] + c(-r1, r1)
yLims <- c1[2] + c(-r1, r1)

plot(c1[1], c1[2], type='n', asp=1, xlim=xLims, ylim=yLims)
drawCircle(c1[1], c1[2], r1, fg='blue', colCtr='blue', pch=19)
drawCircle(c2[1], c2[2], r2, fg='red', bg='red', colCtr='black', pch=4)

Run the code above in your browser using DataLab