[R] How to correct this

Jin.Li@csiro.au Jin.Li at csiro.au
Mon Nov 22 06:20:49 CET 2004

Hi there,

I would like to add a few circles to the following image: 
pred<-matrix(c(0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.7, 0.7, 0.7, 0.7,
0.5, 0.5, 0.7, 0.9, 0.9, 0.7, 0.5, 0.5, 0.7, 0.9, 0.9, 0.7, 0.5, 0.5,
0.7, 0.7, 0.7, 0.7, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5), 6, 6)
image(x, y, pred, col = gray(20:100/100), asp='s', axes=F, xlab=" ",
points(0.5, 0.5, col = 5) # the centre of the image

The centre of these circles needs to be overlapped with the centre of
the image. Any helps are greatly appreciated.

-----Original Message-----
From: Mulholland, Tom [mailto:Tom.Mulholland at dpi.wa.gov.au] 
Sent: Monday, 22 November 2004 12:29 P
To: Li, Jin (CSE, Atherton)
Subject: RE: [R] How to correct this

I think you need to create a complete set of code that can be replicated
by anyone trying to help.
I ran the three grid.circle commands on my current plot and it did what
I expected it to do. It plotted three circles centred in the current
viewport. See the jpeg.

The last command using points makes me think that you need to understand
about units and the setting up of viewports. I have not played around
with this much but I think thr newsletter had an article which may be of
use (although it uses old code I think the differences are minor)

Ciao, Tom

-----Original Message-----
From: Jin.Li at csiro.au [mailto:Jin.Li at csiro.au]
Sent: Monday, 22 November 2004 10:07 AM
To: r-help at stat.math.ethz.ch
Subject: [R] How to correct this

Hi there,


I tried to add a few circles on an existing figure using the following


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.






Jin Li, PhD

Climate Impacts Modeller

CSIRO Sustainable Ecosystems

Atherton, QLD 4883


Ph: 61 7 4091 8802

Email: jin.li at csiro.au <mailto:jin.li at csiro.au> 



	[[alternative HTML version deleted]]

R-help at stat.math.ethz.ch mailing list
PLEASE do read the posting guide!

More information about the R-help mailing list