4. How ggplot Thinks
Content for Wednesday, January 25, 2023
Summary
We start getting into the business of writing R code to make the graphs we want, focusing on ideas about how graphs represent data. In particular we examine the idea of a mapping between some column of data in our table and a visual element—position on the x-axis, position on the y-axis, the property of color, and so on—that faithfully represents that data. We’ll also work on understanding ggplots “flow of action” and the idea of plotting layers on top of layers. Along the way we will learn more geoms and other functions.
Reading
- Hadley Wickham and Garrett Grolemund R for Data Science: Import, Tidy, Transform, Visualize, and Model Data (Sebastopol, California: O’Reilly Media, 2017), http://r4ds.had.co.nz/. Chapter 2, Chapter 3, and Chapter 4.
Slides
The slide deck for this week is available here.
Tip
Tip: If you type ? (or shift + /) while going through the slides, you can see a list of special slide-specific commands.