A Word Cloud Geom for 'ggplot2'

Provides a word cloud text geom for 'ggplot2'. Texts are placed so that they do not overlap as in 'ggrepel'. The algorithm used is a variation around the one of 'wordcloud2.js'.

Travis buildstatus Coveragestatus CRANstatus

ggwordcloud provides a word cloud text geom for ggplot2. The placement algorithm implemented in C++ is an hybrid between the one of wordcloud and the one of wordcloud2.js. The cloud can grow according to a shape and stay within a mask. The size aesthetic is used either to control the font size or the printed area of the words. ggwordcloud also supports arbitrary text rotation. The faceting scheme of ggplot2 can also be used. Two functions meant to be the equivalent of wordcloud and wordcloud2 are proposed.


You can install the released version of ggwordcloud from CRAN with:


or the development version from the github repository


Please check the latest development version before submitting an issue.

Some word clouds

Because sometimes, pictures are better than a thousand words…

#> Loading required package: ggplot2
ggplot(love_words_small, aes(label = word, size = speakers)) +
  geom_text_wordcloud() +
  scale_size_area(max_size = 24) +
    label = word, size = speakers,
    color = speakers
) +
  geom_text_wordcloud_area(aes(angle = 45 * sample(-2:2, nrow(love_words),
    replace = TRUE,
    prob = c(1, 1, 4, 1, 1)
  area_corr_power = 1,
  mask = png::readPNG(system.file("extdata/hearth.png",
    package = "ggwordcloud", mustWork = TRUE
  rm_outside = TRUE
  ) +
  scale_size_area(max_size = 25) +
  theme_minimal() +
  scale_color_gradient(low = "darkred", high = "red")
#> Some words could not fit on page. They have been removed.
library(dplyr, quietly = TRUE, warn.conflicts = FALSE)
library(tidyr, quietly = TRUE)
  love_words_small %>%
    gather(key = "type", value = "speakers", -lang, -word) %>%
  aes(label = word, size = speakers)
) +
  geom_text_wordcloud_area() +
  scale_size_area(max_size = 20) +
  theme_minimal() +

More examples are available in the vignette.


ggwordcloud 0.3.0

  • Novelties:
    • documentation with a lovely example
    • new mask and shape parameters
    • better replacement by using the right scale
  • Bug fixes:
    • workaround for a Cairo issue with some utf8 strings
    • geom_wordcloud_area works even if no sizes are given

ggwordcloud 0.2.0

  • add the rm_outside option
  • wordcloud layout acceleration thanks to better word boxing
  • wordcloud and wordcloud2 approximate replacements

ggwordcloud 0.1.0

  • Initial version

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.


0.3.0 by Erwan Le Pennec, 3 months ago

https://github.com/lepennec/ggwordcloud, https://lepennec.github.io/ggwordcloud/

Report a bug at https://github.com/lepennec/ggwordcloud/issues

Browse source code at https://github.com/cran/ggwordcloud

Authors: Erwan Le Pennec [aut, cre] , Kamil Slowikowski [aut]

Documentation:   PDF Manual  

GPL-3 license

Imports Cairo, grid, Rcpp, scales, colorspace, png

Depends on ggplot2

Suggests testthat, knitr, rmarkdown, ggrepel, wordcloud, wordcloud2, covr, dplyr, tidyr

Linking to Rcpp

See at CRAN