Facets, Colours and Themes
facet_wrap splits by group, colour maps a variable and theme changes the look.
Example
library(ggplot2)
df <- data.frame(x = 1:6, y = c(1, 3, 2, 5, 4, 6), g = rep(c("a", "b"), 3))
ggplot(df, aes(x, y, colour = g)) +
geom_point() +
facet_wrap(~ g) +
theme_minimal()Exercise
Small multiples.
facet_(~ g)
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.