wordcloud2 icon indicating copy to clipboard operation
wordcloud2 copied to clipboard

mask and letterCloud silently fail

Open csteacherd22 opened this issue 9 years ago • 33 comments

Hello, I'm enjoying wordcloud2 and hoping to make use of the unique features. However, the png mask and letterCloud functions have been silently failing. Also, using the provided example of setting figPath to a png fails as per https://rstudio-pubs-static.s3.amazonaws.com/187645_426d719fae56457f84d767fd6f076a43.html:

figPath = system.file("examples/t.png",package = "wordcloud2")
wordcloud2(demoFreq, figPath = figPath, size = 1.5,color = "skyblue")

Similarly, the "https://www.r-bloggers.com/the-wordcloud2-library/" Peace symbol example command: wordcloud2(demoFreq, figPath = "peace.png", size = 1.5, color = "skyblue", backgroundColor="black") also silently fails.

csteacherd22 avatar Dec 10 '16 23:12 csteacherd22

This is a small bug I haven't fix so far.

Have you tried to refresh the viewer or open in the browser?

image

Lchiffon avatar Dec 12 '16 01:12 Lchiffon

Same problem here. Refreshing helps - thanks!

luke-a avatar Dec 12 '16 12:12 luke-a

Sorry Lchiffon, I experience the same issue in Google Chrome (even after reloading the page)... but the code works in IE

PS80 avatar May 01 '17 07:05 PS80

I'm using the library to produce png's as a backend service and getting no output for letterCloud and mask generations.

Thanks for the great feature set, would help out if I was more of an R expert, will watch this bug for now.

zpurcey avatar May 24 '17 00:05 zpurcey

Mostly a "me too" in February 2018: using the latest R 3.4.3 and RStudio 1.1.419 I get the background image for either letterCloud() or the figPath option of wordcloud2. There are never any words, whether I reload or not. Sending it to Chrome gives just a blank white screen, not even the background.

VeloSteve avatar Feb 01 '18 22:02 VeloSteve

I face the same problems after installing the latest version of R 3.4.3 and RStudio 1.1.423 (I have updated all packages also). I get only the background of the letter (letterCloud function) or of the mask (wordcloud2 function with figPath option).

It worked on my old version of R, RStudio and packages but unfortunately it did not save the configuration reference. Maybe someone know if there is a configuration who works ?

Kumpelka avatar Feb 08 '18 14:02 Kumpelka

I'm having the same problem, letterCloud is producing only the background "word" in black, with none of the actual words from the data frame showing. I've tried several different versions of R to no avail.

letterCloud(demoFreq,"R")

image

However, if I re-install the package directly from git rather than cran, it works!

library(devtools) devtools::install_github("lchiffon/wordcloud2") letterCloud(demoFreq,"R")

image

SarahDawsonStats avatar Feb 23 '18 14:02 SarahDawsonStats

Same issue here. "wordcloud2" produces a nice image in RStudio that is viewable in markdown and in an html doc after it is knit, but not viewable in a browser (Chrome or Firefox). All packages updated, RStudio 1.1.442, R version 3.4.4 (2018-03-15)

Here's the doc with an invisible image: http://rpubs.com/bmeyer/372805, Session info included within.

bemeyer avatar Mar 23 '18 09:03 bemeyer

I could manage to make it work in Rstudio after installing the package via github as suggested by SarahDawsonStats, but it needs everytime a refresh. Unfortunately it seems not working in a Shiny application.

AsterAlpestris avatar Apr 04 '18 12:04 AsterAlpestris

Hi all, I ran into the same issue but unfortunately I did not manage to resolve it with SarahDawsonStats' suggestion of downloading the source package. When I reinstall it, I instead get the following error running any type of wordcloud2 output:

Error in yaml.load(readLines(con), error.label = error.label, ...) : argument "error.label" is missing, with no default

Things I have tried so far:

  • Install all of the Windows binaries from from the wordcloud2 CRAN page (only the r-release version will work as intended, save for the image/letter mask functionalities. The other 2 will lead to the error above)
  • Use alternative sources to install the package
  • Perform various fresh installs of the yaml package
  • Googled extensively to find solutions to the error mentioned above but to no avail, and most seemed to stem from unrelated issues
  • Tried to open the image/letter mask in a browser (as per the author's suggestion). Tried in Chrome, Firefox and IE.
  • A fresh install of RStudio + deleting all packages and reinstalling only the bare minimum
  • All of the above I tried both with the provided sample dataset (demoFreq) as well as my own textual dataset.

Any help would be greatly appreciated, I'm not sure where I'm going wrong!

MayoIsLife avatar Apr 11 '18 10:04 MayoIsLife

I had the same problem with nothing displaying from wordcloud2 when I added the figPath argument. Once I changed my default browser from Chrome to IE (and allowed "blocked content") it worked:

wordcloud2(demoFreq, figPath="logo.jpg")

nateofspades avatar May 01 '18 22:05 nateofspades

Sorry, I meet the same problem with MayoIsLife. I did not manage to resolve it by downloading the source package from github.

When installed the package from CRAN, it will show only background. If installed the package from github, it will silently failed.

Could anyone help me to solve the issue? I really enjoying using this package.

HannahChi1628 avatar Jul 27 '18 06:07 HannahChi1628

LetterCloud only returns the word and not the dataset.

Nelson-Gon avatar Oct 01 '18 14:10 Nelson-Gon

Do not use system.file()

I did this and it works:

figPath <- "/Users/jiristodulka/R/web_scraping/reddit_cannabis/canna_leaf.png"

wordcloud2(demoFreq, figPath = figPath, size = 3,color = "green", backgroundColor = "black")

jiristo avatar Feb 24 '19 02:02 jiristo

Hi all

Just an update on this: same issue here with CRAN (0.2.1) and GitHub (0.2.2) packages: using a PNG mask, or using letterCloud(), I don't get anything, just the background colour, even after refreshing or opening the external viewer (in Firefox).

The code I used (with a couple of different PNG files):

wordcloud2(demoFreq,
           figPath = "t.png",
           color = "skyblue",
           backgroundColor = "pink")
letterCloud(demoFreq,
            word = "R",
            color = "skyblue",
            backgroundColor = "pink")

However, the shape argument does work fine:

wordcloud2(demoFreq,
           shape = "star",
           size = 1.5,
           color = "skyblue",
           backgroundColor = "pink")

My system details:

  • R 3.5.3
  • RStudio 1.1.463, with:
    • Mozilla/5.0 (X11; N; Linux x86_64) AppleWebKit/538.1 (KHTML, like Gecko) RStudio Safari/538.1 Qt/5.4.2
  • Ubuntu 18.04

stragu avatar Apr 07 '19 06:04 stragu

Hi Everyone,

I faced the similar issues too. However, I've reinstalled wordcloud2 from dev tools and it worked.

devtools::install_github("lchiffon/wordcloud2")

Ravimoon25 avatar Jun 11 '19 10:06 Ravimoon25

Hello, I am a new learner in R programming. I am faced with a problem that I can not install the package wordcloud2 via command " devtools::install_github("lchiffon/wordcloud2") " , befor which, I have successfully installed install.packages('devtools'). The error is shown as the attached screenshot.

Thanks for your reply. error_install_wordcloud2

Tranquilsun avatar Jul 07 '19 14:07 Tranquilsun

@Tranquilsun your question is not related to this particular issue, so you will have to open a new issue. However, I suspect your problem is not related to the wordcloud2 package. I'd recommend to first try and reinstall it after restarting your R session, and if that fails, look online for an existing solution somewhere as other people have asked similar questions before (for example here). But we should stop discussing your particular issue here as it is not related to this ticket. Good luck!

stragu avatar Jul 09 '19 04:07 stragu

Any resolution here? I installed the package directly from github, which worked once and then I couldn't get it to work again, trying various combinations of refreshing and browser changes. Thank you!

cyarrison1 avatar Oct 28 '19 01:10 cyarrison1

@cyarrison1 try to change the size. I had this problem yesterday and solved it by increasing the size from size= 1.5 to size= 5.

data2030 avatar Nov 12 '19 02:11 data2030

How do you get that font? I've tried a few others, but always get the default ''Segoe UI'

j-tamad avatar Feb 20 '20 04:02 j-tamad

Not a solution but maybe can help someone: I made some test and here some tips:

  1. use widgetsize = c(x, y), where:
  • x is a multiple of the horizontal resolution (in pixels) of the image used as a mask
  • y is a multiple of the vertical resolution (in pixels) of the image used as a mask
  1. always click (1x) refresh the viewer or open in the browser (+ 1x refresh)

  2. (Bad but better as nothing) if still notworking (as desired) rescale your freq variable to smaller value (ex. with scales::rescales(x, to = c(1,7)) and run another time

-> Open in browser and save with ctrl + p

Galfo92 avatar Oct 13 '20 09:10 Galfo92

Not a solution but maybe can help someone: I made some test and here some tips:

  1. use widgetsize = c(x, y), where:
  • x is a multiple of the horizontal resolution (in pixels) of the image used as a mask
  • y is a multiple of the vertical resolution (in pixels) of the image used as a mask
  1. always click (1x) refresh the viewer or open in the browser (+ 1x refresh)
  2. (Bad but better as nothing) if still notworking (as desired) rescale your freq variable to smaller value (ex. with scales::rescales(x, to = c(1,7)) and run another time

-> Open in browser and save with ctrl + p

Unfortunately it is not.

olferievm avatar Oct 16 '20 13:10 olferievm

For those facing this issue, it seems you must provide both a color argument as well as a backgroundColor argument. You may also need to refresh the RStudio image preview window to get the graphic to load.

jeffcsauer avatar Jan 04 '21 19:01 jeffcsauer

I was struggling with this issue for a few hours but managed to make it work by installing the Github version of the package AND by refreshing the RStudio Viewer Pane EVERY TIME I generate a word cloud with a mask. For now, it's enough. Thanks for the instructions!

rafabelokurows avatar Jan 09 '21 18:01 rafabelokurows

I had the same problem with nothing displaying from wordcloud2 when I added the figPath argument. Once I changed my default browser from Chrome to IE (and allowed "blocked content") it worked:

wordcloud2(demoFreq, figPath="logo.jpg")

It did not work for me, I have stuck with this problem for 3 hours, maybe I should skip this ... This package does have bugs..

Cruisecoder avatar Dec 17 '21 23:12 Cruisecoder

after trying all the suggestions provided above I still have issues of figure masking in wordcloud2 till now. any support to overcome this will be highly appreciated!

birasafab avatar Mar 10 '22 11:03 birasafab

I'm also experiencing the same problem, getting a blank output when creating a wordcloud using a mask. Tried different things:

  • CRAN / Github package
  • figPath<-system.file("path",package="wordcloud2") /figPath <- "Globalpath"

But in the end I always get a blank output or the very png I used as mask after computing a couple times.

frarzo avatar May 21 '22 08:05 frarzo

I have the same issue even after re-installing from the Github development version.

Is there anybody Home?

stepminer avatar Nov 09 '22 21:11 stepminer

  1. widgetsize = c(x, y) it did not work

akhtarali007 avatar Dec 07 '22 06:12 akhtarali007