[R] Text annotation of a graph

Lisa lisajca at gmail.com
Thu Aug 4 22:24:45 CEST 2011


Dear All, 

I am trying to add some text annotation to a graph using matplot() as
follows:

  vars <- c("v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v8", "v10")
  id <- seq(5.000, 0.001, by = -0.001)
  sid <- c(4.997, 3.901, 2.339, 0.176, 0.151, 0.101, 0.076, 0.051, 0.026,
0.001)
  rn <- sample(seq(0, 0.6, by = 0.001), 5000, replace = T)
  matplot(rbind(rn, rep(0, length(rn))), rbind(id, id), xlim = c(0, 1),
          type = "l", lty = 1, lwd = 1, col = 1, xlab = "",
          ylab = "", axes = F)
  abline(v = 0, lty = 2)
  axis(1)
  mtext(side = 2, text = c(vars), at = sid, las = 2, line = 0.8)
  axis(3) 

But the text annotation can not be displayed correctly, i.e., some of them
stick together. 
Can anybody help me with this particular problem? Thanks in advance.

Lisa


--
View this message in context: http://r.789695.n4.nabble.com/Text-annotation-of-a-graph-tp3719775p3719775.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list