Skip to content

Instantly share code, notes, and snippets.

@mdneuzerling
Created July 16, 2020 06:08
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 mdneuzerling/2ebc4b6bd2a22c2f9462d1cb7fd5f93f to your computer and use it in GitHub Desktop.
Save mdneuzerling/2ebc4b6bd2a22c2f9462d1cb7fd5f93f to your computer and use it in GitHub Desktop.
library(tidyverse)
tidy_tuesday <- tidytuesdayR::tt_load(2020, week = 28)
coffee <- tidy_tuesday$coffee_ratings
coffee %>%
filter(!is.na(country_of_origin)) %>%
inner_join(
coffee %>%
group_by(country_of_origin) %>%
summarise(n = n(), average_cupper_points = mean(cupper_points)) %>%
filter(n / sum(n) > 0.01),
by = "country_of_origin"
) %>%
ggplot(aes(
x = cupper_points,
y = fct_reorder(country_of_origin, average_cupper_points),
fill = average_cupper_points
)) +
ggridges::geom_density_ridges() +
xlim(5, 10) +
scale_fill_gradient(low = "#A8805C", high = "#5F3622") +
ggtitle("Coffee quality by country of origin") +
xlab("cupper points") +
ylab(NULL) +
theme_minimal(base_size = 16, base_family = "Montserrat") +
theme(legend.position = "none")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment