ggplot(admissions, aes(x = major, y = gender, fill = admitted)) +
geom_tile(color = "white", linewidth = 0.5) + # Create the tiles
geom_text(aes(label = paste0(admitted, "%")), color = "white", fontface = "bold") +
facet_wrap(~gender, ncol = 1, scales = "free_y") +
scale_fill_gradient(low = "lightgreen", high = "darkgreen") +
labs(
title = "Admission Rates to UC Berkeley by Major and Gender",
x = "Academic Major",
y = "Gender",
fill = "Admission %"
) +
theme_minimal() +
theme(strip.text = element_text(face = "bold", size = 12))