Hi: Since you didn't provide any data, you're stuck with my example instead.
# Generate three sine curves on (0, 2*pi) x <- seq(0, 2 * pi, length = 200) df <- data.frame(x, y1 = sin(x), y2 = sin(2 * x), y3 = sin(4 * x)) # Create a small function to type (n), where n is a number to be input mytext <- function(n) paste('(', n, ')', sep = '') # Plot the three curves with matplot() using solid lines and color # Turn off the x-axis labels so that we can rewrite them with axis() with(df, matplot(x, cbind(y1, y2, y3), type = 'l', lty = 1, ylab = "", xaxt = 'n')) axis(1, at = c(0, pi, 2 * pi), labels = c(0, expression(pi), expression(2~pi))) # Locate positions for the text insertion text(2.8, 0.5, mytext(1)) text(4.5, 0.75, mytext(3)) text(5.6, 0.25, mytext(3)) Legends may be a better way to identify and distinguish the curves - here's an example: lnames <- c('sin(x)', 'sin(2x)', 'sin(4x)') legend('topright', lnames, col = 1:3, lty = 1) HTH, Dennis On Sat, Mar 12, 2011 at 8:16 AM, derek <jan.kac...@gmail.com> wrote: > Hello R > I can not figure out, how to add text string or number to lines like on > this > image: > http://r.789695.n4.nabble.com/file/n3350452/graph.png > I have some data series in text file. > > My script: > > require(graphics) > require(stats) > graf=read.table("file",header =FALSE,sep = "", dec = ",",fileEncoding = "", > encoding = "unknown", skip=19,nrows=400) > attach(graf) > plot(V1,V2,type = "l",main = "name",xlab = substitute(lambda (nm)), ylab > =substitute(A)) > lines(V3,V4) > lines(V5,V6) > lines(V7,V8) > lines(V9,V10) > lines(V11,V12) > lines(V13,V14) > lines(V15,V16) > lines(V17,V18) > lines(V19,V20) > lines(V21,V22) > > > -- > View this message in context: > http://r.789695.n4.nabble.com/how-to-label-lines-tp3350452p3350452.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > 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. > [[alternative HTML version deleted]] ______________________________________________ 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.