ggplot2 adds arguments instead of changing behaviour, and delegates new chart types
An implementation of the Grammar of Graphics in R
At a glance
- What is it?
- ggplot2 is the R package that implements the Grammar of Graphics, at version 4.0.3. Its stated policy is to add new functions and arguments rather than change what existing ones do, so old code generally keeps working and new chart types arrive as extension packages.
- Who is it for?
- ggplot2 fits an R workflow that already lives in the tidyverse and wants plots whose encoding is visible in the code, and its own policy of adding rather than changing means an upgrade is unlikely to break a report you already ship.
- Can I use it commercially?
- Check first. The repository uses a licence we do not classify automatically, so read its LICENSE file before any commercial use.
- Is it still maintained?
- Yes. The repository last received commits 4 days ago.
- What is it written in?
- Mainly R, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on November 15, 2026, and from our analysis. They are not legal advice.
Star history
- tidyverse/ggplot27,027 ★ · +28
| Repository | 2026-09-23 | 2026-11-15 |
|---|---|---|
| tidyverse/ggplot2 | 7k | 7k |
28 Stars in the last 53 days, measured from the daily GitHub snapshot. Compare with other projects
Editorial analysis
You supply the data and an aes() mapping, ggplot2 works out the details
ggplot2 inverts the usual drawing order. Instead of calling a function per shape and tracking coordinates yourself, you hand over a dataset and a mapping, and the package fills in the rest: you provide the data, say how variables map to aesthetics, name the graphical primitives, and it takes care of the details. That is the whole premise of a Grammar of Graphics implementation, and it is why the same few lines redraw themselves when the data changes shape. The mapping is where the design decisions live. Which column sits on x, which sits on y, and which one drives colour are arguments of a single aes() call rather than settings buried in theme code, so a reader can see the encoding without tracing through a sequence of imperative commands.
Layers, scales, facets and coords arrive by adding to the plot
Composition happens by addition rather than by configuration. A plot starts from ggplot() with data and aes(), then layers, scales, faceting specifications and coordinate systems are added onto the result:
library(ggplot2)
ggplot(mpg, aes(displ, hwy, colour = class)) +
geom_point()Four categories come up repeatedly. Layers are the geoms, with geom_point() and geom_histogram() the two named in the project's own overview. Scales turn a value into a visual position or a colour, with scale_colour_brewer() as the named example. Faceting specifications such as facet_wrap() split one plot into panels per category, and coordinate systems such as coord_flip() swap the axes. Each of these is a separate object you can compose, and each modifies the plot built so far rather than replacing it, which is why the same plot can carry several of them at once.
Three install routes, and the GitHub one needs pak first
There are three routes, in increasing order of what you get. From CRAN, the package installs with install.packages, and installing tidyverse brings it in along with the rest of that collection:
# The easiest way to get ggplot2 is to install the whole tidyverse:
install.packages("tidyverse")
# Alternatively, install just ggplot2:
install.packages("ggplot2")
# Or the development version from GitHub:
# install.packages("pak")
pak::pak("tidyverse/ggplot2")The third route needs a second package before it works: the commented line above it, install.packages("pak"), has to run first, or the pak::pak() call fails because pak is not installed. That distinction matters more than it looks, because a CRAN install gives you a released version while the pak route tracks the main branch, whose last push was on 2026-10-21. The release feed shows v4.0.3 published on 2026-04-22, after v4.0.2 on 2026-02-03 and v4.0.1 on 2025-11-14. Two routes, two different versions, one package name, so decide which one you want before you write the first plot.
Eighteen years old, and behaviour changes are reserved for strong reasons
The project's own lifecycle note is blunt about what changes. ggplot2 is 18 years old and is used by hundreds of thousands of people to make millions of plots, which by and large means ggplot2 itself changes relatively little. When a change does happen it is generally to add new functions or arguments rather than to change the behaviour of existing ones, and when behaviour does change the note promises it happens for compelling reasons. For an adopter that policy has one clear effect: code you wrote years ago is likely to keep running, and when something does move you hear about it from the changelog rather than from a report you already shipped. NEWS and NEWS.md sit at the top of the repository, so the change record travels with the package. The flip side is that the core will not grow into a charting suite.
New chart types live in extension packages, not in the core
Innovation is deliberately handed off. The guidance for anyone who wants something the package does not do is to look at a community maintained list of extensions rather than to expect it in the core, and the top level of the repository shows how little of that surface is vendored: R/ for the code, man/ for documentation, tests/ and vignettes/ for checks and long form guides, data-raw/ and data/ for datasets and the scripts that build them, pkgdown/ and _pkgdown.yml for the site at ggplot2.tidyverse.org. Nothing in that layout is a chart type registry, because the README points to extensions for new chart types. The cost an adopter carries is dependency surface: each extension has its own release cycle and its own compatibility story, and the gallery is a community list, so pairing versions is on you.
Two help venues, and one of them wants a reproducible example
The project names two places to get help and they ask different things of you. The Posit Community, at forum.posit.co, which used to be called the RStudio Community, takes any ggplot2 question. Stack Overflow carries a ggplot2 tag, and the guidance there is narrower: it is a good source of answers once you have created a reproducible example that illustrates the problem. That distinction decides whether a question gets answered. A question with a minimal reproducible example is one that can be answered once; the same question with a picture of a plot and an error message goes back and forth. The learning path is documented too, from the data visualisation and communication chapters in R for Data Science, through a course by Kara Woo and a webinar by Thomas Lin Pedersen, up to the book ggplot2: Elegant Graphics for Data Analysis for the theory.
It is an R package, and the licence identifier is unresolved
Two gaps are worth settling before a plot leaves your laptop. First, this is an R package and nothing else: installation goes through install.packages or pak, the primary language is R, and no Python distribution is described anywhere in the docs. A Python pipeline needs a different project and its own cost. Second, licence identification is unresolved: the repository ships both a LICENSE file and a LICENSE.md, while the identifier GitHub reports is NOASSERTION rather than a named licence, and the overview does not say which terms apply. A commercial deployment has to read those two files before it ships. Neither gap is hidden, and neither is closed.
Editorial conclusion
ggplot2 fits an R workflow that already lives in the tidyverse and wants plots whose encoding is visible in the code, and its own policy of adding rather than changing means an upgrade is unlikely to break a report you already ship. It is the wrong tool for a Python pipeline, since installation and every documented route are R only, and it is the wrong tool when you want one library to cover every chart type, because that work belongs to extension packages with their own release cycles. Before the first plot goes into a deliverable, check two things: which version you installed, since the CRAN route and the pak route give you 4.0.3 and the main branch respectively, and what the LICENSE and LICENSE.md files actually say, because GitHub reports no named licence for the repository.
Frequently asked questions
What is ggplot2 used for?
It is a system for declaratively creating graphics, based on the Grammar of Graphics. You provide the data, tell it how to map variables to aesthetics and which graphical primitives to use, and it takes care of the details. It is an R package.
How do I install ggplot2?
Run install.packages("ggplot2") from CRAN, or install.packages("tidyverse") to get it with the rest of that collection. For the GitHub version, install pak first and then run pak::pak("tidyverse/ggplot2").
How do I use ggplot2 in R?
Start with ggplot() and aes() for the data and the mapping, then add layers such as geom_point() or geom_histogram(). Scales like scale_colour_brewer(), faceting with facet_wrap() and coordinate systems like coord_flip() are added in the same way.
What are the 7 layers of ggplot2?
The project's own overview does not set out a seven layer list. It names data, the aesthetic mapping, layers, scales, faceting specifications and coordinate systems, then points readers to ggplot2: Elegant Graphics for Data Analysis for the theory behind those pieces.
Can I use ggplot2 in RStudio?
The docs say nothing about which editor you use, because installation goes through install.packages like any other R package. Where the RStudio name does show up is the help forum: the Posit Community, which used to be called the RStudio Community.
Official sources
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/tidyverse-ggplot2)Star history chart for your README
[](https://hysenlabs.com/projects/tidyverse-ggplot2)Was this useful?