0

我正在尝试使用 ggwordcloud 创建一些词云,但无论我如何摆弄geom_wordcloud_area()我的词云中的论点,每个词周围都有很大的空白区域,看起来很可怕。每个在线教程都有超级漂亮的示例(即this和 this当然还有) ,但是无论我做什么,我的看起来都是这样的:

我的难看 wordcloud

上述 wordcloud 的代码(我很欣赏它的频率列/缩放看起来很奇怪,但这不是这里的问题 - 这个问题发生在我输入的任何单词/频率对上):

ggplot(word_freq %>% filter(freq > 0.01), aes(label = WORD, size = freq^3)) + 
geom_text_wordcloud(eccentricity = 1) +
scale_size_area(max_size = 10)+
theme_minimal()

如果有人知道发生了什么,将不胜感激 - 这占用了非常多的时间。

4

1 回答 1

1

It all depends on how you prepared your data. Take a look at my example

library(tidyverse)
library(ggwordcloud)

n=100
word_freq = tibble(
  WORD = rep("word", n),
  freq = abs(rnorm(n))*1000
) %>% mutate(freq = ifelse(freq<100,100,freq))

word_freq %>% 
  ggplot(aes(label = WORD, size = freq)) + 
  geom_text_wordcloud(eccentricity = 1) +
  scale_size_area(max_size = 10)+
  theme_minimal()

enter image description here Does it look good enough for you?

于 2021-09-26T19:29:54.840 回答