Learn R Programming

berryFunctions (version 1.4)

circle: draw circles with a given radius

Description

draws filled circles with a certain radius using polygon and sin

Usage

circle(x, y, r, locnum, ...)

Arguments

x
x coordinate
y
y coordinate
r
radius in units of current plot
locnum
number of calculated points on the circle. DEFAULT: 100
...
further arguments passed to polygon

Value

  • none. Used for drawing.

See Also

polygon

Examples

Run this code
plot(1:10, asp=1)
circle(5,5, r=3)
circle(6,5, r=2, col=2, border=4, lwd=3)

x <- sample(1:20, 15)  ; y <- sample(1:20, 15)
plot(x,y, asp=1) # 1:1 aspect shows they're really circles and not ellipses.
for(i in 1:15) circle(x[i],y[i], r=3, col=rgb(1,0,0,alpha=0.2), border=NA)

Run the code above in your browser using DataLab