Using vector pos with text in R
I am trying to use text
to put some words in my plot. I would like to use a parameter pos
in a vector, so I can specify which of the words to put (for example) above the specified coordinates. But I can't figure out what to put in the vector in order to keep some text elements in the specified coordinates! The documentation allows entries of 1, 2, 3, or 4, each of which moves the text away from the coordinates. What value can I use in mine pos.vector
so as not to change?
Thank!
EDIT:
Here's an example of what I want to do: First I try:
radius <- sqrt(z/pi)
symbols(x,y, circles = radius)
text(z,y,labels=urls)
But this causes some overlap in the labels, so I try to include the vector pos
:
pos.vector <- rep(3, length(urls)) #have to use 1, 2, 3, or 4 here
pos.vector[urls %in% c("victoriassecret")] <- 4
radius <- sqrt(z/pi)
symbols(x,y, circles = z)
text(z,y,labels=urls,pos=pos.vector)
But this approach doesn't allow me to keep the rest of the labels centered because the vector pos
only takes 1, 2, 3, or 4 as input. Grr.
source to share