Skip to content

Instantly share code, notes, and snippets.

@conormm
Created September 1, 2017 20:03
Show Gist options
  • Save conormm/ae9b3669d15b53a1a3aaeb198c51e39e to your computer and use it in GitHub Desktop.
Save conormm/ae9b3669d15b53a1a3aaeb198c51e39e to your computer and use it in GitHub Desktop.
df %>%
group_by(title_year) %>%
summarise(mean_rating = mean(imdb_score),
upper_rating = quantile(imdb_score, 0.975),
lower_rating = quantile(imdb_score, 0.0275)) %>%
ggplot(aes(title_year, mean_rating)) +
geom_line(colour = "dodger blue") +
geom_point(alpha = 0.5) +
geom_smooth(method = "lm", colour = "red", alpha = 0.6, se = FALSE) +
geom_errorbar(aes(ymin = upper_rating, ymax = lower_rating)) +
geom_rug() +
theme_minimal() +
labs(title = "Average IMDB movie rating per year",
x = "Year",
y = "IMDB rating")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment