ggplot2 is a data visualization library for R based on a formal grammar of graphics. It provides a declarative plotting framework that allows users to create complex graphics by combining geometric objects, statistical summaries, and coordinate systems.
The system is distinguished by a layered approach to composition, where visualizations are built incrementally by stacking independent geometric, statistical, and coordinate layers. It utilizes a hierarchical styling engine to manage non-data elements such as backgrounds, fonts, and margins, and includes a multi-panel faceting tool for splitting data into a grid of small multiple plots based on discrete variables.
The library covers broad capability areas including aesthetic data mapping, statistical transformations for calculating bins and densities, and coordinate space projection for Cartesian, polar, and geospatial layouts. It also provides tools for element position adjustment to prevent overlap, visual guide configuration for axes and legends, and utilities for exporting high-resolution raster images or multi-page documents.