>> -----Original Message-----
>> From: [EMAIL PROTECTED]
>> [mailto:[EMAIL PROTECTED] On Behalf Of Irene Mantzouni
>> Sent: Friday, May 02, 2008 7:52 AM
>> To: [EMAIL PROTECTED]
>> Subject: [R] points size in plots
>>
>> Dear list,
>>
>>
>>
>> I would like to produce a plot of variables where the size of
>> the points will be indicative of their standard errors.
>>
>> How is that possible?
>>
>>
>>
>> Thank you!

Do you mean (a) the larger the standard error, the bigger the point, or
(b) the larger the standard error, the smaller the point? (b) makes more
statistical sense.
Anyways, you can use cex. An example with two variables, u and v, in the
case of (a)
u <- rnorm(10,2,3)
v <- rnorm(10,5,4)
se.u <- runif(10,1,4)
se.v <- runif(10,4,7)
x <- 2:11
plot(x,u,cex=se.u/max(se.u))
points(x,v,cex=se.v/max(se.v),pch=19)
And in the case of (b)
u <- rnorm(10,2,3)
v <- rnorm(10,5,4)
se.u <- runif(10,1,4)
se.v <- runif(10,4,7)
x <- 2:11
plot(x,u,cex=(1/se.u)/max(1/se.u))
points(x,v,cex=(1/se.v)/max(1/se.v),pch=19)
If you have NAs in your variables, use the na.rm=TRUE argument of max().
If the standard errors are very different, you can multiply the quantity
evaluated for cex with a positive constant, say
u <- rnorm(10,2,3)
v <- rnorm(10,5,4)
se.u <- runif(10,1,4)
se.v <- runif(10,4,7)
x <- 2:11
w=2.5
plot(x,u,cex=w*(1/se.u)/max(1/se.u))
points(x,v,cex=w*(1/se.v)/max(1/se.v),pch=19)

HTH
Ruben

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to