ggplot2

A layered grammer of graphics in R

Iain Moodie

Expectations

  • I will try to:
    • give you a grammer in which you can describe statistical graphics
    • show how this was used when designing ggplot2
    • walkthrough some examples (not exhaustive)
    • demonstrate some common pitfalls

Expectations

  • I will not:
    • tell you what is a good or bad graphic
    • cover everything in ggplot2

Expectations

  • I expect you to:
    • have attended the previous talk about tidyverse
    • know now what these symbols mean: |> or %>%
    • unless it’s directly related to a slide, save questions to the end

Introduction

What is a (statistical) graphic?

  • How can we succinctly describe a graphic?
  • And how can we create the graphic that we have described?
  • One solution: develop a grammer of graphics

A grammer of graphics

  • A grammer is “the fundamental principles or rules of an art or science” (OED Online 1989)
  • Provides the foundation for understanding, describing, and creating graphics
  • Language analogy:
    • Good grammar is just the first step in creating a good sentence

The grammer of graphics