drawcircle: add a circle to a plot

View source: R/drawcircle.R

drawcircleR Documentation

add a circle to a plot

Description

draws a circle with vertical alignment at bottom

Usage

drawcircle(x, y, rad, npoints = 70, border = NA, ...)

Arguments

x

numeric, x location

y

numeric, y location

rad

numeric, radius

npoints

integer, number of points along the circumference

border

color for circumference, by default omitted (i.e. NA)

...

other graphical parameters, e.g. col

Value

adds to current plot

Examples

plot(0, 0, asp=1, xlim=c(-2,2), ylim=c(-2,2), "n")
# by radius
drawcircle(-2, -2, 2, col="red")
drawcircle(-2, -2, 1, col="blue")
drawcircle(-2, -2, 0.5, col="gold")
# by area
drawcircle(2, -2, sqrt(2*2*pi/pi), col="red")
drawcircle(2, -2, sqrt(2*1*pi/pi), col="blue")
drawcircle(2, -2, sqrt(2*0.5*pi/pi), col="gold")

gobbios/cfp documentation built on April 11, 2022, 2:22 a.m.