2: Your First Visualization
Content for Wednesday, April 1, 2026
Before class
📖 Reading:
TipAssignment 1 is assigned today
Assignment 1: Getting Started — due Sunday, April 5 at 11:59 PM.
During class
We’ll cover:
- Why visualize data? (Anscombe’s Quartet)
- Introduction to ggplot2
- The grammar of graphics: data, aesthetics, geoms
- Aesthetic mappings (color, size, shape)
- Faceting for small multiples
- Themes and labels
Slides
View slides in new tab Download PDFEmbedded slides
After class
✅ Practice:
- Create at least 3 different plots using the
mpgdataset - Try different geoms:
geom_point(),geom_bar(),geom_histogram(),geom_boxplot() - Experiment with mapping different variables to color, size, and shape
- Use
facet_wrap()to create small multiples - Save your favorite plot using
ggsave()
NoteThe ggplot2 template
ggplot(data = <DATA>, mapping = aes(<MAPPINGS>)) +
<GEOM_FUNCTION>()This simple template can create almost any visualization!