[R] to draw a smooth arc

Prof Brian Ripley ripley at stats.ox.ac.uk
Tue May 1 18:04:50 CEST 2007


On Tue, 1 May 2007, Greg Snow wrote:

> Here is an approach that clips the circle you like from symbols down to
> an arc (this will work as long as the arc is less than half a circle,
> for arcs greater than half a circle, you could draw the whole circle
> then use this to draw an arc of the bacground color over the section you
> don't want):
>
> library(TeachingDemos)
> plot(-5:5, -5:5, type='n')
> clipplot( symbols(0,0,circles=2, add=TRUE), c(0,5), c(0,5) )

I had considered this approach: clipping a circle to a rectangle isn't 
strictly an arc, as will be clear if the line width is large.
Consider

clipplot(symbols(0, 0 ,circles=2, add=TRUE, lwd=5), c(-1,5), c(-1,5))

Note too that what happens with clipping is device-dependent.  If R's 
internal clipping is used, the part-circle is converted to a polygon.


-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-help mailing list