plotSentiment: Line plot with sentiment scores

Description Usage Arguments Value See Also Examples

View source: R/plot.R

Description

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

Usage

1
2
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
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() 

Example output

Attaching package: 'SentimentAnalysis'

The following object is masked from 'package:base':

    write

SentimentAnalysis documentation built on April 10, 2018, 1:03 a.m.