[R] drawing half-circles
Duncan Murdoch
dmurdoch at pair.com
Mon May 17 13:02:08 CEST 2004
On Mon, 17 May 2004 09:39:01 +0100, Barry Rowlingson
<B.Rowlingson at lancaster.ac.uk> wrote:
>adiamond at fas.harvard.edu wrote:
>> Dear wonderful R community,
>>
>> I've been creating color-coded concentric circles using the "points" function,
>> but I just realized that what I would really like to do is draw color-coded
>> concentric half-circles.
>
>> What should I do?
>
>Write a 'halfCircle' function.
>
>halfCircle <- function(x,y,r,start=0,end=pi,nsteps=30,...){
> rs <- seq(start,end,len=nsteps)
> xc <- x+r*cos(rs)
> yc <- y+r*sin(rs)
> lines(xc,yc,...)
>}
Alexis, besides lines(), you should look at the polygon() function
(which can fill the regions).
Duncan Murdoch
More information about the R-help
mailing list