[R] textplot() in wordcloud package

Jim Lemon drjimlemon at gmail.com
Sat Mar 14 02:53:14 CET 2015


Hi Fraser,
"textplot" is fairly similar to the "thigmophobe.labels" function in
plotrix. I think the problem is that when the user passes an explicit
position for the labels with the default "new=TRUE" argument, the "pos"
argument is passed to the "plot" function, causing the warning. If the
"pos" argument was named rather than extracted from "...", this could be
avoided. However, if you want to specify the position of the labels, you
could probably use the "text" function.

Jim


On Sat, Mar 14, 2015 at 7:29 AM, Fraser D. Neiman <fneiman at monticello.org>
wrote:

> 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 at 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.
>

	[[alternative HTML version deleted]]



More information about the R-help mailing list