ggwordcloud2: wordcloud2 approximate replacement

View source: R/ggwordcloud-wrapper.R

ggwordcloud2R Documentation

wordcloud2 approximate replacement

Description

ggwordcloud2 is meant as an approximate replacement for wordcloud2. It has almost the same syntax but fewer options. In particular, there is no background image (so far...). As the underlying algorithms are not strictly equal, the resulting wordcloud is only similar to the ones one can obtain with wordcloud2.

Usage

ggwordcloud2(
  data,
  size = 1,
  color = "random-dark",
  minRotation = -pi/4,
  maxRotation = pi/4,
  shuffle = TRUE,
  rotateRatio = 0.4,
  shape = "circle",
  ellipticity = 0.65,
  figPath = NA,
  ...
)

Arguments

data

a dataframe whose two first columns are the names and the freqs or a table

size

scaling factor. Default to 1

color

color scheme either "random-dark", "random-light" or a list of color of the size of the dataframe. Default to "random-dark"

minRotation

the minimal rotation angle

maxRotation

the maximal rotation angle

shuffle

if TRUE, the words are shuffled at the beginning

rotateRatio

the proportion of rotated words

shape

control the shape of the cloud

ellipticity

control the eccentricity of the wordcloud

figPath

path to an image used a mask

...

the remaining parameters are passed to geom_text_wordcloud

Value

a ggplot

Examples

set.seed(42)
data("love_words_latin_small")

ggwordcloud2(love_words_latin_small[,c("word", "speakers")])

ggwordcloud documentation built on June 22, 2024, 7:28 p.m.