Part 11 Plotting with ggplot2

Set up the workspace:

# Load required packages
library(tidyverse) # loads ggplot2 and other tidyverse packages
library(gapminder) # loads the gapminder dataset

# Set a default figure size
knitr::opts_chunk$set(fig.width = 5, fig.height = 4, fig.align = "center")

11.1 Learning Objectives

By the end of this lesson, you will be able to:

  • Have a sense of why we’re learning ggplot2
  • Understand the importance of statistical graphics in communicating information
  • Identify the components of the grammar of graphics underlying ggplot2
  • Use different geometric objects and aesthetics to explore various plot types

11.2 Resources

Here are some good walkthroughs that introduce ggplot2:

Here are some good resource to use as a reference: