plotWordcloud: Plot a wordcloud given words and frequencies

Description Usage Arguments Details Author(s) Examples

View source: R/wordcloud.R

Description

General grid based wordcloud drawing function

Usage

1
2
3
4
5
plotWordcloud(words, freq, rot.per = 0.3, max_min = c(1, 0.1),
  scale = 0.4, min.freq = 3, max.words = Inf, random.order = FALSE,
  colors = "black", random.colors = FALSE, fontface = 1,
  algorithm = "circle", tryfit = TRUE, add = FALSE, grob = FALSE,
  dimensions = unit(c(1, 1), "npc"))

Arguments

words

vector of words to draw

freq

frequencies for words, has to be the same length as words vector

rot.per

percentage of vertical words

max_min

relative scales to adjust the size difference between largest and smallest word, by default the largest word is written with 10 times as large font than the smallest

scale

a fraction of the available space on figure that will be covered with the bounding boxes of words

min.freq

minimal frequency of words to be displayed

max.words

maximal number of words to be displayed

random.order

plot words in random order. If false, they will be plotted in decreasing frequency

colors

vector of colors fro the words. This vector will be extrapolated into as many colors as needed, starting with the first color for lower frequencies and ending with last color for higher frequencies.

random.colors

if true, assigns random color for the words.

fontface

fontface for the words (1 - regular; 2 - Bold; 3 - italic)

algorithm

algorithm to find positions of words possible values: "circle", "leftside" and "rightside".

tryfit

if TRUE the algorithm checks if all words fit to the figure, if not it tries gradually smaller values of scale parameter until everything fits

add

if TRUE adds the picture to existing plot.

grob

if TRUE returns the text grob instead of drawing it

dimensions

a two element vector of units giving the width and height of the word cloud respectively

Details

Uses the algorithm from wordcloud package to calculate the positions of the words. It then uses grid graphics to plot the words on screen. The shape of the wordcloud depends on the shape of the plotting window

Author(s)

Raivo Kolde <raivo.kolde@eesti.ee>

Examples

1
 plotWordcloud(c("Audi", "Volkswagen", "Opel", "Porsche", "Mercedez", "BMW"), 8:3)

GOsummaries documentation built on Nov. 8, 2020, 6:50 p.m.