Welcome to a ggplot2 grammar of guide! This guide isn’t comprehensive, and it will likely continue to evolve. But it’s at a place that it might be useful to orient you, a colleague, or a student to ggplot2 and extensions.

ggplot2 is an open source software package and implementation of the ‘Grammar of Graphics’ framework. I’m grateful to the package creator Hadley Wickham and the ggplot2 team that has worked so hard to creating this incredible tool, to the contributors and maintainers of the R language in which it is built, and to folks who have given me valuable feedback on communicating data viz and data viz tools, especially my students!

Getting Started

Right now, you’re actually on the visual table of contents page for quick reference.

But you can get started with the guide itself here, which contains a guided discussion for thinking about data viz and ggplot2, and code+output walk-throughs for getting the work done.

first grammar lesson: A data visualization, is composed of geometric shapes, that take on aesthetics which represent variables from a data set. ggplot() + aes() + geom_*()


To use the visual table of contents, mouse over to see a preview of what will be covered, then click any link or visual preview to go through to the flipbook (code-movies built with the flipbookr and xaringan packages) that will show you a detailed build of the previewed contents.

Not into human language grammar? Just ignore that first column!

What? How?
1. The Declarative Mood Declaring the data ggplot(data = gapminder) +
2. The Interogative Mood Asking for representation of variables by aesthetics (color, size, x position, etc.) (also known as aesthetic mapping)