[R] Drawing a circle

Josef Eschgfaeller esg at felix.unife.it
Thu May 19 14:10:45 CEST 2005


Mario Morales wrote:

> I need to draw a circle

I would do it with complex numbers
and polar coordinates:

Circle = function (t,a)
{a*cos(t)+1i*a*sin(t)}

interval=c(-8,8)
plot(interval,interval,type="n",xlab="",ylab="",
   asp=1,axes=F)
t=seq(0,2*pi,by=0.01)
center=2+3i; radius=5
lines(center+Circle(t,radius))
locator(1)
dev.off()

Josef Eschgfäller
-- 
Josef Eschgfäller
Dipartimento Matematico
Universita' di Ferrara
http://felix.unife.it


More information about the R-help mailing list