Re: [R] how to label lines

From: D Kelly O'Day <koday_at_processtrends.com>
Date: Sat, 12 Mar 2011 18:09:54 -0800 (PST)

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.

______________________________________________
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.
Received on Sun 13 Mar 2011 - 02:13:41 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sun 13 Mar 2011 - 11:50:21 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive