Skip to content
Back to formatted view

Raw Message

Message-ID: <CA+hbrhXCYrx4y27vwQnL7jPkDaABFmFtuADcGJys2Czfj=S6jA@mail.gmail.com>
Date: 2012-09-07T17:02:56Z
From: Peter Langfelder
Subject: Is something wrong wiht draw.circle()?
In-Reply-To: <1347033870195-4642514.post@n4.nabble.com>

On Fri, Sep 7, 2012 at 9:04 AM, Chris82 <rubenbauar at gmx.de> wrote:
> Hey R users,
>
> I am a little bit confused.
>
>
> require(plotrix)
>
> plot(0,xlim=c(-10,10),ylim=c(-10,10),type="n",xlab="",ylab="")
> draw.circle(0,0,5)
>
> lines(c(0,0),c(0,5))
> lines(c(0,5),c(0,0))

The culprit are unequal margins. Issue

par(mar = c(4,4,4,4))

before your code, and you will get a consistent circle.

More generally, when the scale of x axis and y axis are not the same
(i.e., 1 unit corresponds to different distances __on screen__),
drawing a naive circle would result in something that looks like an
ellipse on screen. Plotrix can apparently draw a real circle but then
the radius is "correct" only in the x direction.

HTH,

Peter