[R] text position with offset

Jinsong Zhao jszhao at yeah.net
Thu Oct 3 18:48:33 CEST 2013


Hi there,

I have draw a scatter plot. Now, I hope to label the points in the plot. 
For example:

plot(1:10)
text(1:10, 1:10, LETTERS[1:10])

In the above line, I can set position for each labels with pos, e.g.:

text(1:10, 1:10, LETTERS[1:10], pos = sample(1:4, 10, replace = TRUE))

as what you have seen, the length of pos can be longer than 1. in the 
above case, it has the length 10.

However, I can not set offset with length longer than 1. The following 
code always set the offset to 0.1 rather than 0.1, 0.2, ..., 1 for the 
10 labels.

text(1:10, 1:10, LETTERS[1:10], pos = sample(1:4, 10, replace = TRUE), 
offset = seq(0.1, 1, 0.1))

it seems that adj also can not be set for multiple points with different 
values.

Any hints? Thanks in advance.

Regards,
Jinsong



More information about the R-help mailing list