ggplot2

ggplot2 is a visualization package for the R language that describes itself as “a system for declaratively creating graphics, based on The Grammar of Graphics.” Rather than calling a function for each kind of chart, a user supplies data, declares how variables map to visual properties (the aesthetics), and chooses graphical building blocks (the geoms); the system then assembles the figure and handles the technical details. It was created by Hadley Wickham, with first public release in 2007, and is now maintained as part of the tidyverse.

The package’s conceptual foundation is set out in Wickham’s paper “A Layered Grammar of Graphics,” published in the Journal of Computational and Graphical Statistics in 2010. The paper builds on Leland Wilkinson’s Grammar of Graphics, describing extensions and refinements that Wickham developed while implementing ggplot2. The key contribution is the idea of a layered grammar: a plot is decomposed into independent components-data, aesthetic mappings, geometric objects, statistical transformations, scales, coordinate systems, and facets-that can be combined and recombined.

In practice this grammar is expressed by adding layers together. A plot begins with data and a mapping, and geoms, scales, statistics, and facets are added on top with an explicit plus operator. Because each component is independent, a chart can be modified one piece at a time-swap a geom, add a facet, change a scale-without rewriting it, which is a very different mental model from picking a named chart type and tweaking options.

ggplot2 became the dominant visualization library in the R world and one of the most influential pieces of data-visualization software anywhere. Its layered-grammar approach gave practitioners a precise vocabulary for describing graphics and demonstrated that a principled, compositional API could be both expressive and approachable.

The influence reached well beyond R. The grammar-of-graphics idea, popularized by ggplot2, shaped later tools across languages, including grammar-based interfaces in Python visualization libraries and dedicated implementations of the same principles. For a generation of analysts, ggplot2 is where the grammar of graphics moved from a theoretical framework into an everyday way of building charts.

Sources

Last verified June 8, 2026