[R] Text annotation of a graph

Benno Pütz puetz at mpipsykl.mpg.de
Fri Aug 5 19:31:06 CEST 2011


Hi Lisa,


On 4.Aug.2011, at 22:24, Lisa wrote:

> 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. 
Looking at your code that is exactly what you asked for ....


> Can anybody help me with this particular problem? Thanks in advance.
> 
What exactly would you like to do?

	Benno



More information about the R-help mailing list