I am trying to change the color of the red points in the plot() function used by the Sentimentr package. I think plot() returns a ggplot2 object, but when I try to add parameters to the plot() function (e.g., color = 'blue' or fill = 'blue'), nothing changes. Any help is appreciated! Reproducible example below.
library(sentimentr)
library(magrittr)
library(dplyr)
out <- presidential_debates_2012 %>%
get_sentences() %$%
sentiment_by(dialogue, list(person))
plot(out)
After starting your R session, type:
trace(sentimentr:::plot.sentiment_by, edit = T)
change everything what you want, e.g. change "red" to "blue" on line 21 to change the color of the points. Then repeat what you did in your example:
library(sentimentr)
library(magrittr)
library(dplyr)
out <- presidential_debates_2012 %>%
get_sentences() %$%
sentiment_by(dialogue, list(person))
plot(out)