Skip to content

Instantly share code, notes, and snippets.

@Chuyakova
Forked from kovacskokokornel/plotting
Created November 15, 2019 13:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Chuyakova/4069406559e2d42af476aa713e13e6bf to your computer and use it in GitHub Desktop.
Save Chuyakova/4069406559e2d42af476aa713e13e6bf to your computer and use it in GitHub Desktop.
library(fmsb)
df <- read_csv("imdb_top_250_sentiments.csv", col_types = c(col_character(),
col_character(),
col_double(),
col_double(),
col_character(),
col_character()))
counts <- as.data.frame(table(df$Overall_sentiment))
p<-ggplot(data=counts, aes(x=Var1, y=Freq)) +
geom_bar(stat="identity") +
xlab("Overall sentiment of storyline") +
ylab("Frequency")
p
histogram_maker <- function(column, xlabel) {
p <- ggplot() + aes(column) +
geom_histogram() +
xlab(xlabel)
return(p)
}
# Could be called with Positive and Negative as well.
p <- histogram_maker(df$Neutral, "Neutral")
ggsave("Neutral_histo.png", p)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment