4. How ggplot Thinks

Content for Wednesday, January 31, 2024


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.


  • Hadley Wickham, Garrett Grolemund, and Mine Çetinkaya-Rundel R for Data Science: Import, Tidy, Transform, Visualize, and Model Data, Second. (Sebastopol, CA: O’Reilly Media, 2023), https://r4ds.hadley.nz. Chapter 1, Chapter 9

  • Kieran Healy Data Visualization: A Practical Introduction (Princeton: Princeton University Press, 2019), http://socviz.co/. Chapter 3


The slide deck for this week will appear here.