Please look at the labcurve function in the Hmisc package. Here is one line from the documentation of ?labcurve For automatic positioning of labels or keys, a curve is labeled at a point that is maximally separated from all of the other curves. As you, the documentation uses the same words you do.
If you don't have it yet: install.packages("Hmisc") library("Hmisc") ?labcurve On Sat, Mar 12, 2011 at 5:12 PM, derek <jan.kac...@gmail.com> wrote: > Thank you for reply. I think, in script you posted, I have to manually add > coordinates for label. I don't want do it manually. I would like to add > labels at the points, where the lines are maximally separated. (points of > maximum separation). Graphic representation of my data looks very similar > to > image I posted earlier. The legend is unnecessary, because each line > represents same substance at different concentration. I would like to have > the lines labeled with numeric value (e.g.. "0.9 mg/l", 0.8 mg/l) > > Example of my data in graph.txt file: > V1 V2 V3 V4 V5 V6 > 200 0.100 200 0.110 200 0.120 > 210 0.130 210 0.150 210 0.170 > 230 0.100 230 0.100 230 0.120 > > odd numbered columns (e.g.. V1) represents x axis > even numbered columns (e.g.. V2) represents y axis > > Package hmisc and function labcurve should do trick, but I barely > understand > from manual how to do it. > Probably something like this: > > graph=read.table("graph.txt",header =FALSE,sep = "", dec = ",",fileEncoding > = "", > > encoding = "unknown", skip=19,nrows=400) > > attach(graf) > a=data.frame(V1,V2) > b=data.frame(V3,V4) > c=data.frame(V5,V6) > > label(a) <- 0.1 mg/l > label(c) <- 0.2 mg/l > label(c) <- 0.3 mg/l > > > > > -- > View this message in context: > http://r.789695.n4.nabble.com/how-to-label-lines-tp3350452p3350942.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<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.