首页 > 解决方案 > Wordcloud2 包不适用于 figpath

问题描述

我看到了类似的帖子,但解决方案没有帮助。

试图将这张德克萨斯州的照片与文字云一起使用。但是它不起作用....

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')

标签: rpathword-cloud

解决方案


给你,带着你的德州照片。(唷......识别它真的花了很多时间。)

在此处输入图像描述

笔记

您的代码是正确的,它也可以正常工作。wordcloud2有一个微妙的免责声明,您错过了......

带有 fig 和 letterCloud 的 wordcloud 可能会在 Rstudio Viewer 中消失,遇到此错误时打开浏览器

所以,你需要做的是:

  1. 运行你的代码。
  2. 点击下图中带圆圈的图标:

在此处输入图像描述


推荐阅读