Overview

ggplot2 is the most popular visualization library in the R ecosystem. It is based on a formal 'Grammar of Graphics,' which allows users to build complex plots by layering different components: data, aesthetics (mapping data to visual properties), and geometries (the actual shapes).

Key Concepts

  • Layers: Adding components one by one (e.g., ggplot() + geom_point() + geom_smooth()).
  • Aesthetics (aes): Mapping variables to x, y, color, size, etc.
  • Faceting: Creating small multiples based on a categorical variable.
  • Themes: Controlling the non-data appearance of the plot.

Philosophy

It encourages a structured and logical approach to visualization, making it easy to create consistent and high-quality graphics.

Related Terms