DSCI_531_viz-1

Lecture 1: Basic plot ‘types’ with ggplot2

Lecture Preamble

Today’s Lessons

After going over the course syllabus, we’ll go over the following three lessons:

  1. Orientation to statistical graphics
  2. The grammar of graphics
  3. Plotting with x and y aesthetics

Resources

Concepts from today’s class (and next class) are closely mirrored by the following resources, which introduce ggplot2, although are organized in different ways for each.

The following are good walk-throughs that introduce ggplot2:

Here are some other resources you might find useful:

Participation

To get participation points for today:

  1. Fill out this exercise sheet with me in class.
  2. git commit whatever we finish in class to your participation repository.

Lesson 1: Orientation to statistical graphics

Learning Objectives

By the end of this lesson, students are expected to be able to:

Discussion

There are four main ways you can produce graphics in R. In order of inception, they are

ggplot2 will receive the strongest focus in this course. Why?

Stackoverflow was my main source of learning. Google what you’re trying to do, and persevere. You can do it.

Jenny Bryan on statistical graphics:

Lesson 2: The grammar of graphics

Learning Objectives

By the end of this lesson, students are expected to be able to:

Discussion

Leland Wilkinson lays out the grammar of graphics in his book.

They define the “space of statistical graphics”.

The grammar components, adapted to ggplot2 (gg = grammar of graphics), where the bold ones are necessary to specify for every plot:

Lesson 3: Plotting with x and y aesthetics

Learning Objectives

This live-coding-based lesson focusses on:

By the end of this lesson, students are expected to be able to:

Demonstration

Let’s fill out as much as we can of the worksheet labelled lec1-worksheet.Rmd.