[R] drawing a circle using symbols
Sundar Dorai-Raj
sundar.dorai-raj at pdf.com
Tue Nov 29 20:10:34 CET 2005
Troels Ring wrote:
> Dear friends, I was drawing a circle with centrum in (1,-1) and
> radius 5 to show my girl that the line y=3*x+1 goes through (1,4) and
> (-2,-5) of the circle, but on Windows XP, R 2.20 the drawing was not
> good at all, and the known solutions were not shown in the graph. I
> guess I got it wrong? Is this use not intended ?
>
> Best wishes
> Troels Ring, MD
> Aalborg, Denmark
>
> symbols(x=1,y=-1,circles=5,inches=FALSE, xlim=c(-10,10),ylim=c(-10,10))
> curve(3*x+1,-10,10,1000,add=T)
> abline(v=c(-2,1))
> abline(h=c(-1,-5,4))
>
Hi, Troels,
The aspect ratio of y to x is not 1. So, the symbol is visually a circle
but in reality an ellipse. Try
symbols(x = 1, y = -1, circles = 5, inches = FALSE,
asp = 1, xlim = c(-10, 10), ylim = c(-10, 10))
curve(3 * x + 1, -10, 10, 1000, add = TRUE)
abline(v = c(-2, 1))
abline(h = c(-1, -5, 4))
HTH,
--sundar
More information about the R-help
mailing list