Data Visualization with ggplot2
⏱ Estimated Time to Complete
About 120–150 minutes, including practice exercises and knowledge quizzes.
Welcome to the Data Visualization with ggplot2 module. Plots are one of the fastest ways to understand data, but a plot is only useful if you understand why R drew it the way it did. Throughout this module, you’ll build things up piece by piece: running small bits of code, noticing exactly what changes, and testing your own guesses before moving on. By working through progressively harder plots this way, you will build an intuition for the grammar of graphics that ggplot2 is built on, rather than memorising a list of unconnected commands.
The module comprises three tutorials.
- Grammar of Graphics Foundations
- Visualizing Distributions & Relationships
- Faceting & Composing Plots
Each tutorial ends with a short Knowledge Quiz, and the module as a whole ends with a Self-Test Assignment that asks you to apply everything you’ve learned to a dataset you haven’t seen before.
Learning Goals
After completing this module, you will be able to:
Building Plots with the Grammar of Graphics
- Explain why
ggplot2builds plots by layering components. - Construct a basic plot from a dataset.
- Add informative labels and a pre-built theme to a plot.
Choosing the Right Geometry
- Choose an appropriate geometry for a single categorical variable, a single continuous variable, two continuous variables, and a continuous variable broken down by a categorical variable.
- Compare the strengths and weaknesses of different geometries.
Faceting & Composing Multi-Plot Figures
- Split a single plot into an array of subplots using
facet_wrap()andfacet_grid(). - Combine several independent plots into a single arranged figure.
- Save a
ggplot2figure to disk in a chosen file format.
Click the button below to get started with the first tutorial.