[R] Drawing a circle

Kenneth Roy Cabrera Torres krcabrer at unalmed.edu.co
Thu May 19 14:20:28 CEST 2005


Try

a<-1.975 # valore x del centro
b<-1.215 # valores y del centro
r<-1.46 # radio
symbols(a,b,circle=r,inches=F)

Hope it works

PS:
Espero que te funcione.
Saludos desde Medell{in, Colombia.


On Thu, 19 May 2005 05:14:44 -0500, Mario Morales  
<malfonso at telecom.com.co> wrote:

> Hi.
>
> I need to draw a circle whit center (a,b) and radio r. So I use the
> R code below
>
> a<-1.975 # valore x del centro
> b<-1.215 # valores y del centro
> r<-1.46 # radio
> x1<-seq(a-r,a+r,by=0.01); #los valores de x
> yp<-sqrt(r^2-(x1-a)^2)+b; # los valores y a partir de la raÃ­z positiva
> yn<-(-1)*sqrt(r^2-(x1-a)^2)+b; # los valores y a partir de la raÃ­z  
> negativa
> x<-c(x1,x1);  y<-c(yp,yn);
>
> plot(x,y,type="l",ylab="",xlab="",xlim=range(x),ylim=range(y));
>
>
> My circle have two problems.
>
> First. I don't want the horizontal line and I don't know how avoid
> it.
>
> Second. It is shaped like ellipse. I need adjust the x and y scales,
> but I don't know how.
>
> Can you help me???
>
> there is another way to draw a circle whit R ?
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!  
> http://www.R-project.org/posting-guide.html



-- 
Kenneth Roy Cabrera Torres
Uninversidad Nacional de Colombia
Sede Medellin
Tel 430 9351
Cel 315 504 9339




More information about the R-help mailing list