whatisgithub

What is ggplot2?

tidyverse/ggplot2 — explained in plain English

Analysis updated 2026-06-24

6,929RAudience · dataComplexity · 2/5Setup · easy

In one sentence

An R package for making charts and graphs by describing what you want in code, map your data to axes and colors, then add layers like points, bars, or lines to build up a visualization.

Mindmap

mindmap
  root((ggplot2))
    What it does
      Data visualization
      Layered charts
      R language
    Chart Types
      Scatter plots
      Line charts
      Bar charts
      Histograms
    Key Concepts
      Data mapping
      Layers
      Facets
      Scales
    Learning
      R for Data Science
      ggplot2 book
      Stack Overflow
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Create a colored scatter plot of two variables in R with three lines of code

USE CASE 2

Build layered charts by adding visual elements like points, lines, and bars on top of each other

USE CASE 3

Split a chart into small panels called facets to compare subgroups side by side in a single figure

What is it built with?

RCRAN

How does it compare?

tidyverse/ggplot2cxli233/friendsdontletfriendsrstudio/shiny
Stars6,9297,0555,648
LanguageRRR
Setup difficultyeasyeasyeasy
Complexity2/51/52/5
Audiencedataresearcherdata

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · easy Time to first run · 5min

Install with a single R command from CRAN, no external services or system dependencies required.

So what is it?

ggplot2 is an R package for making charts and graphs. It is one of the most widely used tools for data visualization in the R programming language, and it is installed by hundreds of thousands of people. The core idea is that you describe what you want to see by specifying your data and how different variables should map to visual properties like position, color, or size, and the library figures out how to draw it. The approach is built around layering: you start with a base call that sets the dataset and the axes, then you add layers for the actual marks (points, lines, bars, histograms), then optional layers for colors or scales, and then optional facets if you want to split the chart into small multiples. A short example in the README shows three lines of R code producing a colored scatter plot of car engine size versus fuel efficiency. Installation is a single command in R, either as part of the broader tidyverse collection of packages or on its own from CRAN, the standard R package repository. The project is mature and stable: the README notes it is 18 years old and changes slowly by design, with most new development happening in the ecosystem of extension packages rather than in ggplot2 itself. A gallery of community extensions is maintained separately. For learning, the README points to several resources: chapters in the free online book R for Data Science, an O'Reilly video course, a YouTube webinar, the R Graphics Cookbook for quick recipes, and a dedicated ggplot2 book for deeper understanding of the theory. Help is available through the Posit Community forums and Stack Overflow.

Copy-paste prompts

Prompt 1
I have an R data frame with columns for temperature and humidity. Use ggplot2 to create a scatter plot with temperature on the x-axis, humidity on the y-axis, and points colored by month.
Prompt 2
Show me how to use ggplot2 to make a bar chart of sales by product category, with bars sorted from highest to lowest and custom axis labels.
Prompt 3
I want to create a faceted line chart in ggplot2 showing trends for each country in my dataset as a separate panel. How do I use facet_wrap?
Prompt 4
I am using ggplot2 for the first time. Walk me through adding layers step by step: a base plot, then geom_point, then color by group, then a clean theme.
Prompt 5
How do I install just ggplot2 from CRAN without the full tidyverse, and what is the minimal code to plot my first scatter chart?

Frequently asked questions

What is ggplot2?

An R package for making charts and graphs by describing what you want in code, map your data to axes and colors, then add layers like points, bars, or lines to build up a visualization.

What language is ggplot2 written in?

Mainly R. The stack also includes R, CRAN.

How hard is ggplot2 to set up?

Setup difficulty is rated easy, with roughly 5min to a first successful run.

Who is ggplot2 for?

Mainly data.

Open on GitHub → Ask about another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.