Learn R Programming

plotrix (version 2.5-2)

draw.circle: Draw a circle.

Description

Draws a circle on an existing plot.

Usage

draw.circle(x,y,radius,nv=100,border=NULL,col=NA,lty=1,lwd=1)

Arguments

x,y
Coordinates of the center of the circle.
radius
Radius of the circle in user units.
nv
Number of vertices to draw the circle.
border
Color to use for drawing the circumference.
col
Color to use for filling the circle.
lty
Line type for the circumference.
lwd
Line width for the circumference.

Value

  • A list with the x and y coordinates of the points on the circumference.

See Also

polygon

Examples

Run this code
plot(1:5,seq(1,10,length=5),type="n",xlab="",ylab="",main="Test draw.circle")
 draw.circle(2,2,0.5,border="purple",lty=1,lwd=1)
 draw.circle(2.5,8,0.6,border="red",lty=3,lwd=3)
 draw.circle(4,3,0.7,border="green",lty=1,lwd=1)
 draw.circle(3.5,7,0.8,border="blue",lty=2,lwd=2)

Run the code above in your browser using DataLab