0

I'm trying to create some wordclouds using ggwordcloud but no matter how I fiddle with the arguments in geom_wordcloud_area() my wordclouds come out looking horrible with each word having a huge margin of white space around it. Every online tutorial has super slick looking examples (i.e. this, and this, and of course) however mine look like this no matter what I do:

My bad looking wordcloud

Code for the above wordcloud (I appreciate that the frequency column/scaling of it seem weird but that's not the issue here - this issue happens with any word/freq pairs I input):

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

Would be incredibly grateful if anyone knows what's going on - this has taken up a ridiculously huge amount of time.

Vinícius Félix
  • 8,448
  • 6
  • 16
  • 32
  • Could you provide a [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example)? – T. C. Nobel Sep 25 '21 at 19:48

1 Answers1

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?

Marek Fiołka
  • 4,825
  • 1
  • 5
  • 20
  • When I use this code I do not get the same output as you do - I still get the exact same issues as before which is very bizarre. I'm not sure how to add an image to this comment to demonstrate what it looks like but its basically the same as the original example I provided. – ChazzFingers Sep 27 '21 at 05:29
  • You can always edit your question. There, post the plot you receive using my code. When editing a question, use the Image tool to insert a previously saved image of the plot. Also check what version of R, Rstudio, and tidyverse, ggwordcloud packages you have. – Marek Fiołka Sep 27 '21 at 09:02