how do print labels next to a plot in R? -
i plotting 2 lines using
plot(x,y, type="l", color="red")
and
points(x2,y2, type="l", color="blue")
i want able add label next each line (instead of legend). pretty sure possible using package in http://directlabels.r-forge.r-project.org/.
yet, don't find easy way of doing that.
you can use locator()
within text()
point&click method.
y <- rnorm(100, 10) y2 <- rnorm(100, 20) x <- 1:100 plot(x, y, type = "n", ylim = c(0, 40), xlim = c(0, 120)) lines(x, y) lines(x, y2, col = "red") text(locator(), labels = c("red line", "black line)"))
Comments
Post a Comment