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 PDF

Embedded slides

After class

Practice:

  1. Create at least 3 different plots using the mpg dataset
  2. Try different geoms: geom_point(), geom_bar(), geom_histogram(), geom_boxplot()
  3. Experiment with mapping different variables to color, size, and shape
  4. Use facet_wrap() to create small multiples
  5. 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!