Chapter 3 Making Graphs

3.1 Class material

Note: most of this class talk in workshop style, so any recordings are short and the slides are brief

We will work through these files as in-class exercises: class3a.R and class3b.R. These are based on Healy (2018) chapters 2 and 3 respectively.

Reading the first 3 chapters of Healy (2018) before the next class is essential

3.2 Resources

This book is recommended for the course, and for this lecture in particular:

Healy, K. (2018). Data visualization: a practical introduction. Princeton University Press.

3.2.1 Other resources

3.3 Post-class exercises

Review the introduction and Chapter 1 ‘Look At Data’ of Healy (2018)

Work through Chapter 2 ‘Get Started’ from 2.3 onwards (“Things to know about R”), we are ignoring the material on RMarkdown for now (we’ll get there, see here).

Work through Chapter 3 ‘Make a plot’

3.4 Checklist

Worked through the scripts linked at the top of this page

Completed the post reading from Healy (2018)

Key concepts (chapter 2):

  • variables and functions
  • variables are typed (e.g. can be numeric or character)
  • and how you detect what type a variable is
  • indexing for variables and data frames

In the console, understood

  • the shortcut keys for the assignment operator <-
  • the use of tab for autocomplete
  • the use up arrow to cycle through previous commands
  • CTRL + ENTER to run highlighted text

Key concepts (chapter 3):

  • Tidydata
  • The fundamental ggplot “recipe”
    • plots have data, aesthetic mappings (‘aes,’ ‘mappings’) and layers
    • adding mappings, adding geoms, geom properties, other layers (e.g. labs)
    • mappings are inherited by geom layers