Just a quick note to thank David Carlson and Jim lemon for the helpful replies 
on this... 

The easiest solution are to punt on WordCloud and use either the plotrix or 
maptools packages.

In plotrix the function is thigmophobe.labels().  In mapTools it's pointLabel()

Neither complains when you pass it the pos= parameter.

Thank you one and all!

Best, Fraser



-----Original Message-----
From: David L Carlson [mailto:dcarl...@tamu.edu] 
Sent: Monday, March 16, 2015 12:02 PM
To: David L Carlson; Fraser D. Neiman; r-help@r-project.org
Subject: RE: textplot() in wordcloud package

Another possibility is to use pointLabel() in package maptools. For your example

library(maptools)

plot(x,y)
pointLabel(x, y, text1)

Advantages of pointLabel() are that it returns a list of the x and y 
coordinates of the labels that you can tweak if necessary and, at least in your 
example, it does a better job of avoiding labels being chopped at the plot 
margins.

-------------------------------------
David L Carlson
Department of Anthropology
Texas A&M University
College Station, TX 77840-4352

-----Original Message-----
From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of David L Carlson
Sent: Monday, March 16, 2015 10:44 AM
To: Fraser D. Neiman; r-help@r-project.org
Subject: Re: [R] textplot() in wordcloud package

You should contact the package maintainer about this. The problem is that the 
pos= argument is being passed to strwidth() and strheight() and those functions 
do not know what to do with it. In the meantime:

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

will eliminate the warnings.

-------------------------------------
David L Carlson
Department of Anthropology
Texas A&M University
College Station, TX 77840-4352

-----Original Message-----
From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Fraser D. Neiman
Sent: Friday, March 13, 2015 3:29 PM
To: r-help@r-project.org
Subject: [R] textplot() in wordcloud package

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

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to