Skip to content

Instantly share code, notes, and snippets.

@will-r-chase
Created April 4, 2022 00:53
Show Gist options
  • Save will-r-chase/b4cb001aa71b9adc9f2e9d938ad54efd to your computer and use it in GitHub Desktop.
Save will-r-chase/b4cb001aa71b9adc9f2e9d938ad54efd to your computer and use it in GitHub Desktop.
##Your turn
library(tidyverse)
#plastic pollution dataset
plastics <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2021/2021-01-26/plastics.csv')
#Take a plot you made with the plastic pollution dataset (it doesn't need to be a scatter plot)
#And apply the principles you learned about for axes, grids, borders, etc.
#If you don't want to use your own plot, you can use this one...
#wrangle data
data <- plastics %>%
group_by(parent_company) %>%
summarize(total = sum(grand_total, na.rm = TRUE)) %>%
arrange(desc(total)) %>%
slice(4:14) %>%
mutate(parent_company = ifelse(parent_company == "NULL", "Unknown",
parent_company))
#example starting plot
ggplot(data) +
geom_col(aes(x = total, y = reorder(parent_company, total)), fill = "orchid4")
#now apply your styling of the grids, axes, borders, and backgrounds
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment