[R] how to label lines

D Kelly O'Day koday at processtrends.com
Sun Mar 13 03:09:54 CET 2011


Here is a working example that allows you to interactively label curves where
you want:

 x <- c(200,210,230)
 y1 <- c(0.1, 0.13, 0.1)
 y2 <- c(0.11, 0.15,0.1)
 y3 <- c(0.12,0.17,0.12)

 df <- data.frame(x, y1,y2,y3)
 lab <- c("0.1 mg/l","0.2 mg/l","0.3 mg/l")

 plot(df$x, df$y1, type="l", col="blue", xlab="", ylim=c(0,.25))
 points(df$x, df$y2, type="l", col="grey")
 points(df$x, df$y3, type="l", col="green")

 text(locator(3), lab, adj=0)



--
View this message in context: http://r.789695.n4.nabble.com/how-to-label-lines-tp3350452p3351195.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list