[R] Drawing a circle on an existing graph.

David Winsemius dwinsemius at comcast.net
Sat Mar 12 20:22:04 CET 2011


On Mar 12, 2011, at 10:56 AM, Allan Kamau wrote:

>> --- On Sat, 3/12/11, Allan Kamau <kamauallan at gmail.com> wrote:
>>
>>> From: Allan Kamau <kamauallan at gmail.com>
>>> Subject: [R] Drawing a circle on an existing graph.
>>> To: r-help at r-project.org
>>> Received: Saturday, March 12, 2011, 3:08 AM
>>> I would like to draw a circle on a
>>> graph I am plotting in R and use
>>> the current plot's coordinate system.
>>> The most basic functionality I am looking for is the
>>> ability to plot a
>>> circle on an already existing graph by simply providing the
>>> xy
>>> coordinates for it's centre and the radius.
>>>
>>> I am also looking for a way to obtain x,y values of a point
>>> (of a
>>> circle) by specifying only the origin x,y the angle and
>>> radius.
>>>
>>> Please point me so such a library and perhaps some simple
>>> one line code.
>>>
>>> Allan.
>>>
> On Sat, Mar 12, 2011 at 5:28 PM, John Kane <jrkrideau at yahoo.ca> wrote:
>> Is this of any use? http://tolstoy.newcastle.edu.au/R/help/06/04/25821.html
>>
>
> Thank you John, that is what I was looking for.
> The code does draw a neat circle that is not stretched. After plotting
> the circle on an existing plot I notice that the original plot was
> indeed stretched somehow by approximately some 1:1.1 ratio (I think).
> Now I am looking for a way to enforce none stretching in my original
> graph.

`plot.window` has an `asp` argument that is useful for that purpose.  
Most plotting with base graphics will pass an asp=1 argument along as  
part of the `...` arguments,

-- 

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list