Skip to contents

Plot polarity scores of words

Usage

textplot_terms(
  x,
  highlighted = NULL,
  max_highlighted = 50,
  max_words = 1000,
  ...
)

Arguments

x

a fitted textmodel_lss object.

highlighted

quanteda::pattern to select words to highlight. If a quanteda::dictionary is passed, words in the top-level categories are highlighted in different colors.

max_highlighted

the maximum number of words to highlight. When highlighted = NULL, words to highlight are randomly selected proportionally to polarity ^ 2 * log(frequency).

max_words

the maximum number of words to plot. Words are randomly sampled to keep the number below the limit.

...

passed to underlying functions. See the Details.

Details

Users can customize the plots through ..., which is passed to ggplot2::geom_text() and ggrepel::geom_text_repel(). The colors are specified internally but users can override the settings by appending ggplot2::scale_colour_manual() or ggplot2::scale_colour_brewer(). The legend title can also be modified using ggplot2::labs().