[R] superimposing some random points on a plot

Debs Majumdar debs_stata at yahoo.com
Tue May 24 20:34:37 CEST 2011


Hi All,

i) I wanted a plot with a x axis that ranges from 25 to 75 points  and 2 normal curves on it with y-axis suppressed. 

ii) One with mean 60 and standard error 2 and the other one with mean 40 and standard error 5.

iii) At last, I'd like you to pull some random values from those distributions and superimpose them, e.g. the numbers 1, 2, 3, ... 10 as symbols 
superimposed on top of the normal curves.

I have no idea how do to the last part (iii). Any help is appreciated.  This is what I did for the first two parts.

######

x <- seq(25,75)
y1 <- dnorm(x,40,5)
plot(x,y1,type="l", lwd=2, col="blue",yaxt="n",ylim=c(0,0.18),ylab="",xlab="two veru different populations")
y2 <- dnorm(x,60,2)
lines(x,y2,type="l", lwd=2, col="red",yaxt="n", ylim=c(0,0.18))


#####


Thanks,

 -Debs



More information about the R-help mailing list