Skip to contents

Sentiment Data and Plot

Usage

tm_sentiment_plot(
  sentiment_dat,
  colors = c("green", "red"),
  max_words = 100,
  same_colors = TRUE,
  title_size = 2,
  scale = c(5, 1)
)

Arguments

sentiment_dat

Sentiment dataframe created with [tm_sentiment()].

colors

Colors (in order) for the sentiment chart.

max_words

Numeric vector. Maximum number of words (`default = 100`).

same_colors

Logical. Should the titles have the same colors as the words (`default = TRUE`)?

title_size

Numeric vector. Size of the title (`default = 2`).

scale

Numeric vector. Range of the size of the words (`default = c(5,1)`).

Value

A ggplot object

Examples


library(janeaustenr)
library(ggplot2)
library(dplyr)
df <-
  austen_books() %>%
  filter(book == "Sense & Sensibility")
 
dat <- tm_sentiment(df, "text")

tm_sentiment_plot(dat)