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
::opts_chunk$set(fig.width = 5, fig.height = 4, fig.align = "center") knitr
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:
- r4ds: data-vis chapter.
- The ggplot2 book, Chapter 2
- Jenny Bryant’s ggplot2 tutorial
- Andrew Heiss’s data visualization course
Here are some good resource to use as a reference: