[R] how to draw a circle
csardi at rmki.kfki.hu
Sat Apr 22 19:58:29 CEST 2006
Hmmm, could you explain this a bit?
You want to add a circle to a plot? See the examples in help(symbols)
Or you want to calculate the coordinates of the points on a circle?
t <- seq(0,2*pi,length=100)
coords <- t(rbind( 10+sin(t)*2, 20+cos(t)*2))
Here (10,20) is the center of the circle, and 2 is its radius.
If you set length to a bigger number you'll get smoother resolution.
A points (x,y) is inside the circle if (c1-x)^2+(c2-y)^2 < r^2
(c1, c2) is the center of the circle, r is its radius.
On Sat, Apr 22, 2006 at 01:42:46PM -0400, Jian Zhang wrote:
> how to draw a circle (e.g. radius=10cm) of one point?
> And how to choose these points in the circle?
> [[alternative HTML version deleted]]
> R-help at stat.math.ethz.ch mailing list
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Csardi Gabor <csardi at rmki.kfki.hu> MTA RMKI, ELTE TTK
More information about the R-help