Re: [R] to draw a smooth arc

From: Paulo Barata <>
Date: Tue, 01 May 2007 14:29:53 -0300

Dr. Snow and Prof. Ripley,

Dr. Snow's suggestion, using clipplot (package TeachingDemos), is maybe a partial solution to the problem of drawing an arc of a circle (as long as the line width of the arc is not that large, as pointed out by Prof. Ripley). If the arc is symmetrical around a vertical line, then it is not so difficult to draw it that way. But an arc that does not have this kind of symmetry would possibly require some geometrical computations to find the proper rectangle to be used for clipping.

I would like to suggest that in a future version of R some function be included in the graphics package to draw smooth arcs with given center, radius, initial and final angles. I suppose that the basic ingredients are available in function "symbols" (graphics).

Thank you very much.

Paulo Barata
(Rio de Janeiro - Brazil)

Prof Brian Ripley wrote:
> 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.
> mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Wed 02 May 2007 - 04:40:34 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 02 May 2007 - 07:31:42 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.