# theme_classic() removes gridlines and gives a clean axis
p + theme_classic(base_size = 24)Spring 2026 | Data 2 (399)
Jeffrey M. Girard | Lecture 13c
Apply complete themes to rapidly change the look of plots
Customize individual theme elements for fine-grained control
Combine multiple plots into complex layouts using patchwork
theme_*()theme(...)element_*(){patchwork} package
+, |, / operators# Create example plots to work with
p1 <- ggplot(mpg, aes(x = displ)) +
geom_histogram(bins = 10, fill = "steelblue", color = "white") +
labs(x = "Engine Displacement", y = NULL)
p2 <- ggplot(mpg, aes(x = hwy)) +
geom_histogram(bins = 10, fill = "seagreen", color = "white") +
labs(x = "Highway MPG", y = NULL)
p3 <- ggplot(mpg, aes(x = displ, y = hwy)) +
geom_point(alpha = 0.5) +
labs(x = "Engine Displacement", y = "Highway MPG")