Re: [R] to draw a smooth arc

From: Prof Brian Ripley <>
Date: Tue, 01 May 2007 13:41:11 +0100 (BST)

On Tue, 1 May 2007, Jim Lemon wrote:

> Paulo Barata wrote:
>> Dear R-list members,
>> I would like to draw a smooth arc. I can draw an arc
>> parametrically, but this produces an arc too coarse,
>> even allowing for different increments in sequence t
>> in the example below. Function "symbols" (graphics) does
>> produce a smooth circle, but it cannot produce an arc.
>> Please see the following example, drawing complete circles:
>> plot(-5:5,-5:5,type='n')
>> ## draws circle with function symbols (package graphics)
>> ## - inner circle is very smooth:
>> symbols(0,0,circles=2,add=TRUE)
>> ## draws circle parametrically - outer circle is too coarse:
>> pi <- 4*atan(1)
>> t <- seq(0,2*pi,0.02)
>> lines(4*cos(t),4*sin(t))
>> Package "plotrix" has a function "draw.arc", but arcs produced
>> with this function are also either too coarse or too polygonal,
>> depending on the number of polygons used to approximate the arc.
>> Is there a way to harness the characteristics of function
>> "symbols" (graphics) to draw a smooth arc, not just a complete
>> circle?
> Hi Paulo,
> I may be misunderstanding you, but have you tried to increase the number
> of segments in the arc using the "n" argument?
> draw.arc(1,1,1,n=100)

Put it another way, drawing arcs is not a primitive in the R graphics system but drawing circles is. So there is no low-level way to draw an arc of a circle except via line segments. (Quite a few graphics devices draw circles via line segments, but not all and vector-graphics systems like postscript can often do better.)

Brian D. Ripley,        
Professor of Applied Statistics,
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________ mailing list
PLEASE do read the posting guide
and provide commented, minimal, self-contained, reproducible code.
Received on Wed 02 May 2007 - 00:16:39 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 - 02:31:13 GMT.

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