Nice, thank you.
--
View this message in context:
http://r.789695.n4.nabble.com/how-to-label-lines-tp3350452p3351605.html
Sent from the R help mailing list archive at Nabble.com.
__
R-help@r-project.org mailing list
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 = ,
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
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
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
Problem solved:
require(graphics)
require(stats)
require(hmisc)
HBA=read.table(file,header =FALSE,sep = , dec = ,,fileEncoding = ,
encoding = unknown, skip=60,nrows=210)
attach(HBA)
labcurve( list( One= list( V1,V2), Two= list( V3,V4),
Three=list( V5,V6), Four= list( V7,V8), Five= list(
On Mar 12, 2011, at 6:35 PM, derek wrote:
Problem solved:
require(graphics)
require(stats)
require(hmisc)
HBA=read.table(file,header =FALSE,sep = , dec = ,,fileEncoding
= ,
encoding = unknown, skip=60,nrows=210)
attach(HBA)
labcurve( list( One= list( V1,V2), Two= list( V3,V4),
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=,
8 matches
Mail list logo