Message-ID: <41A16DB4.6000909@pdf.com>
Date: 2004-11-22T04:40:20Z
From: Sundar Dorai-Raj
Subject: How to correct this
In-Reply-To: <2BEE99D7F6F1484EBDD1D22167385E75375B8A@exqld1-ath.nexus.csiro.au>
Jin.Li at csiro.au wrote:
> Hi there,
>
>
>
> I tried to add a few circles on an existing figure using the following
> codes
>
>
>
> grid.circle(x=0.5, y=0.5, r=0.1, draw=TRUE, gp=gpar(col=5))
>
> grid.circle(x=0.5, y=0.5, r=0.3, draw=TRUE, gp=gpar(col=5))
>
> grid.circle(x=0.5, y=0.5, r=0.5, draw=TRUE, gp=gpar(col=5))
>
> points(0.5, 0.5, col = 5) # centre of the circle
>
>
>
> , but all circles moved away from the centre. Could we do any
> corrections to this? Thanks.
>
>
>
> Regards,
>
>
>
> Jin
>
If you are using Lattice (where grid is a more natural fit) then you can
do the following:
library(lattice)
library(grid)
xyplot(0.5 ~ 0.5,
panel = function(x, y, ...) {
grid.circle(x, y, 0.5, default.units = "native")
panel.xyplot(x, y, ...)
},
xlim = c(0, 1),
ylim = c(0, 1))
I'm not sure how grid is supposed to behave in a non-trellis.device.
--sundar