简体   繁体   中英

Wordcloud2 package not working for figpath

I saw a similar post but the solution did not help.

Trying to use this photo of Texas with a word cloud. It isn't working however....

word_cloud <- structure(list(word = c("climate", "change", "global", "warming", 
"energy", "carbon", "u.s", "president", "emissions", "people", 
"obama", "gas", "world", "report", "power", "water", "time", 
"scientists", "study", "national"), count = c(2474L, 1655L, 944L, 
815L, 755L, 635L, 585L, 570L, 564L, 556L, 522L, 484L, 475L, 462L, 
435L, 398L, 375L, 354L, 352L, 341L)), row.names = c(NA, -20L), class = c("tbl_df", 
"tbl", "data.frame"))

figPath <- "tex4.png" #TODO
wordcloud2(word_cloud, figPath = figPath, size = 1.5,color='skyblue')

Here you go, with your texas pic.( Phew... It really took a lot to identify it.)

在此处输入图像描述

Note

Your code is right and it's working too. There is a subtle disclaimer from wordcloud2 which you have missed is...

wordcloud with fig and letterCloud may disappeared in Rstudio Viewer, open into brower when you meet this bug

So,what you need to do is:

  1. run your code.
  2. click on the circled icon as shown in fig below:

在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM