plotSentiment: Line plot with sentiment scores

View source: R/plot.R

plotSentimentR Documentation

Line plot with sentiment scores

Description

Simple line plot to visualize the evolvement of sentiment scores. This is especially helpful when studying a time series of sentiment scores.

Usage

plotSentiment(
  sentiment,
  x = NULL,
  cumsum = FALSE,
  xlab = "",
  ylab = "Sentiment"
)

Arguments

sentiment

data.frame or numeric vector with sentiment scores

x

Optional parameter with labels or time stamps on x-axis.

cumsum

Parameter deciding whether the cumulative sentiment is plotted (default: cumsum=FALSE).

xlab

Name of x-axis (default: empty string).

ylab

Name of y-axis (default: "Sentiment").

Value

Returns a plot of class ggplot

See Also

plotSentimentResponse and plot.SentimentDictionaryWeighted for further plotting options

Examples

sentiment <- data.frame(Dictionary=runif(20))

plotSentiment(sentiment)
plotSentiment(sentiment, cumsum=TRUE)

# Change name of x-axis
plotSentiment(sentiment, xlab="Tone")

library(ggplot2)
# Extend plot with additional layout options
plotSentiment(sentiment) + ggtitle("Evolving sentiment")
plotSentiment(sentiment) + theme_void() 

SentimentAnalysis documentation built on Aug. 24, 2023, 1:07 a.m.