plot_words: Plot a wordcloud with words ordered and coloured according to...

View source: R/plot_words.r

plot_wordsR Documentation

Plot a wordcloud with words ordered and coloured according to a dimension (x)

Description

Plot a wordcloud with words ordered and coloured according to a dimension (x)

Usage

plot_words(
  x,
  y = NULL,
  words,
  wordfreq = rep(1, length(x)),
  xlab = "",
  ylab = "",
  yaxt = "n",
  scale = 1,
  random.y = T,
  xlim = NULL,
  ylim = NULL,
  col = c("darkred", "navyblue"),
  fixed_col = NULL,
  ...
)

Arguments

x

The (approximate) x positions of the words

y

The (approximate) y positions of the words

words

A character vector with the words to plot

wordfreq

The frequency of the words, defaulting to 1

xlab

Label of the x axis

ylab

Label of the y axis

yaxt

see par documentation

scale

Maximum size to scale the wordsize

random.y

if TRUE, the y position of words is random, otherwise it represents the word frequency.

xlim

Starting value of x axis

ylim

Starting value of y axis

col

A vector of colors that is passed to colorRamp to interpolate colors over x axis

fixed_col

Optionally, a vector of the exact colors given to words.

...

additional parameters passed to the plot function

Value

nothing

Examples

x = c(-10, -5, 3, 5)
y = c(0, 2, 5, 10)
words = c('words', 'where', 'you', 'like')


plot_words(x,y,words, c(1,2,3,4))


corpustools documentation built on May 31, 2023, 8:45 p.m.