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 ?
Drawing a circle
6 messages · Mario Morales, Chuck Cleland, Josef Eschgfaeller +3 more
See ?symbols. For example: > a <- 1.975 # valore x del centro > b <- 1.215 # valores y del centro > r <- 1.460 # radio > plot(0,0, type = "n", ylim=c(b - r, b + r), xlim=c(a - r, a + r)) > symbols(x = a, y = b, circles = r)
Mario Morales 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
Chuck Cleland, Ph.D. NDRI, Inc. 71 West 23rd Street, 8th floor New York, NY 10010 tel: (212) 845-4495 (Tu, Th) tel: (732) 452-1424 (M, W, F) fax: (917) 438-0894
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
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
On Thu, 19 May 2005 05:14:44 -0500, Mario Morales <malfonso at telecom.com.co> wrote:
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.
For that second problem I would suggest using function eqscplot() on package:MASS. Description: Version of a scatterplot with scales chosen to be equal on both axes, that is 1cm represents the same units on each. Best Regards, Ky??sti Kurikka
If a solid circle is ok then one can use the symbol pch=19 and blow it up using cex=, e.g. plot(0, pch=19, cex=5, col="blue") See balloonplot in package gplots for an example of this.
On 5/19/05, Chuck Cleland <ccleland at optonline.net> wrote:
See ?symbols. For example:
> a <- 1.975 # valore x del centro > b <- 1.215 # valores y del centro > r <- 1.460 # radio > plot(0,0, type = "n", ylim=c(b - r, b + r), xlim=c(a - r, a + r)) > symbols(x = a, y = b, circles = r)
Mario Morales 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
-- Chuck Cleland, Ph.D. NDRI, Inc. 71 West 23rd Street, 8th floor New York, NY 10010 tel: (212) 845-4495 (Tu, Th) tel: (732) 452-1424 (M, W, F) fax: (917) 438-0894
______________________________________________ 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