[R] Add ID numbers on a plot

Uwe Ligges ligges at statistik.tu-dortmund.de
Tue Jun 30 00:32:04 CEST 2009


See ?text

Uwe Ligges


Steve Hong wrote:
> Dear List,
> 
> I have (for example) 50 observations collected from 50 experimental sites and want to look at changes of 50 observations as function of time in a graph. I found that I could do that using R-code below: 
> 
> time2 <- 1:25
> y1=rnorm(25, mean=0, sd=1)
> y2=rnorm(25, mean=0, sd=1)
> ...
> y50=rnorm(25, mean=2, sd=1)
> plot(time2, y1, type='b', xlim=range(0,30), ylim=range(y1, y2), xlab='x', ylab='y', pch="1",col=3)
> points(time2, y2, type='b', col="red", xlab='x', ylab='y', pch="2")
> ...
> points(time2, y50, type='b', col="red", xlab='x', ylab='y', pch="50")
> 
> Also, I wanted to add IDs of 50 individual sites within each lines but found it does not work using 'pch' within 'points' function. Do you have any suggestion? 
> 
> Thank you in advance,
> 
> Steve
> 
> ______________________________________________
> R-help at 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.




More information about the R-help mailing list