layout | root | title | level |
---|---|---|---|
lesson |
../.. |
Data visualization with ggplot2 |
misc |
This lesson contains an Rmd file with code and documentation for an introduction to the ggplot2 package for data visualization. Upon completing this lesson, learners will be able to use ggplot2 to explore high-dimensional data by faceting and scaling scatter plots in small multiples.
The first half of the lesson uses the qplot
convenience function, as it will be intuitive for learners already familiar with base graphics. Furthermore, when searching for help with ggplot2, learners will inevitably encounter examples using qplot
.
The second half of the lesson introduces the grammar of graphics and the more comprehensive ggplot
function for creating plots layer-by-layer. It introduces learners to the philosophy of ggplot
, recreates several of the examples in the first half of the lesson using ggplot
, and demonstrates creating other types of plots with ggplot
.
The lesson should take approximately 30 minutes. Learners should already have a basic introduction to R, including:
- Installing and loading packages
- Loading built-in data with the
data()
function - Inspecting data frames with
head()
,str()
, etc. - Basic plotting using base graphics
- FIXME: add more examples of novel types of visualization using
ggplot
other than "named" plots like scatter plots, histograms, etc. - FIXME: Populate the exercise under the
qplot
section. - FIXME: Add another exercise at the (current) end of the
ggplot
lesson.