04: Customizing plots

Author
Affiliation

Prof Amanda Luby

Carleton College
Stat 220 - Fall 2026

Tip

If you need a refresher for how to access the quarto file from this document, see Activity01

Load Data

Note: This code reads the two datasets, joins them, and then makes a new group variable. Make sure to run this chunk before trying to make your graph!

tuition = readr::read_csv("https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2020/2020-03-10/tuition_cost.csv")

salary = readr::read_csv("https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2020/2020-03-10/salary_potential.csv")

college_pay = tuition |>
  inner_join(salary, by = "name") |>
  filter(type != "For Profit") |>
  mutate(
    group = case_when(
      name == "Carleton College" ~ "Carleton",
      state == "Minnesota" ~ "Other MN colleges",
      TRUE ~ "Everywhere else"
    ),
    group = factor(group, levels = c("Carleton", "Other MN colleges", "Everywhere else"))
  ) |>
  arrange(desc(group))

Warm up: recreate graph from slides

# Include your code here