[R] textplot() in wordcloud package

Fraser D. Neiman
Fri, 13 Mar 2015 20:29:16 -0000

Dear All,

The textplot() function in the wordcloud package seem to do a good job with
generating non-overlapping labels on a scatter plot.
But it throws "warnings" when I try to use the pos= parameter to
position the text labels relative to a given x-y point.

Here is a simple example:

 x<-runif(100)
 y<-runif(100)
text1<- rep('LAB', 100)

 plot(x,y)
 textplot(x,y, text1, new=F, show.lines=F,
          pos=4)

There were 50 or more warnings (use warnings() to see the first
50)
> warnings()
Warning messages:
1: In strwidth(words[i], cex = cex[i], ...) : "pos" is not a graphical
parameter
2: In strheight(words[i], cex = cex[i], ...) : "pos" is not a
graphical parameter

How can I pass the pos=parameter to text() without generating the warnings?

I am doubly puzzled by the warnings because in the graph that results from the
foregoing code,
The labels are to the  right of the points, as 'pos=4' requests.

Thanks!

Fraser D. Neiman