Re: [R] how to draw an ellipse

From: Barry Rowlingson <B.Rowlingson_at_lancaster.ac.uk>
Date: Fri 19 Aug 2005 - 01:31:22 EST

Romain Francois wrote:

> Why don't you want to use any specific library ? You can't reinvent the > wheel !!

  True, but Madonna is always reinventing herself...

> There is a package ellipse on CRAN which will do what you are looking for.
> Have you tried
>  > RSiteSearch("ellipse")

  its simple geometry really:

> theta=seq(0,2*pi,len=100)
> e=1.5
> r=3
> x=e*r*cos(theta)
> y=r*sin(theta)
> plot(x,y,asp=1)

  rotate with:

> phi=pi/4
> xr=x*sin(phi)+y*cos(phi)
> yr=-x*cos(phi)+y*sin(phi)
> plot(xr,yr,asp=1)

  or something. Wrap that up into a function and you're done. This is off-the-cuff, I've probably messed something up. So use one prepared earlier from a library...

Baz



R-help@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 Received on Fri Aug 19 01:35:38 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:39:53 EST