Graphics with ggplot2

College of Forestry Workshop

This two-hour workshop focuses on introducing students to the ggplot2 package in R for making graphics.

The first half of the workshop focuses on learning the syntax and terminology used in ggplot2 while making a series of simple, exploratory plots with a built in dataset. The goal of this section is to expose students to many different kinds of graphs as well as cover some of the common pitfalls folks run into when first using ggplot2.

In the second half of the workshop we focus on controlling the overall appearance of a graphic when making “publication-ready” plots. We’ll go through the code to create two fairly complicated graphics, building each one layer by layer so students can see how the plot changes with each addition. Students will also see some data manipulation to reshape a dataset prior to plotting, which is often necessary when plotting data with ggplot2.

I provide an R script that we’ll run code from during the workshop as well as a PDF document. The PDF is a written version of the workshop, including code and output, to be used as a reference.