ggplot2.tidyverse.org Open in urlscan Pro
2606:50c0:8002::153  Public Scan

Submitted URL: http://ggplot2.tidyverse.org/
Effective URL: https://ggplot2.tidyverse.org/
Submission: On October 20 via api from US — Scanned from DE

Form analysis 1 forms found in the DOM

<form class="form-inline my-2 my-lg-0" role="search">
  <span class="algolia-autocomplete" style="position: relative; display: inline-block; direction: ltr;"><input type="search" class="form-control me-sm-2 aa-input" aria-label="Toggle navigation" name="search-input" data-search-index="search.json"
      id="search-input" placeholder="Search for" autocomplete="off" spellcheck="false" role="combobox" aria-autocomplete="list" aria-expanded="false" aria-owns="algolia-autocomplete-listbox-0" dir="auto"
      style="position: relative; vertical-align: top;">
    <pre aria-hidden="true"
      style="position: absolute; visibility: hidden; white-space: pre; font-family: &quot;Source Sans Pro&quot;; font-size: 19.2px; font-style: normal; font-variant: normal; font-weight: 400; word-spacing: 0px; letter-spacing: 0px; text-indent: 0px; text-rendering: auto; text-transform: none;"></pre>
    <span class="aa-dropdown-menu" role="listbox" id="algolia-autocomplete-listbox-0" style="position: absolute; top: 100%; left: 0px; z-index: 100; display: none; right: auto;">
      <div class="aa-dataset-content"></div>
    </span>
  </span>
</form>

Text Content

Skip to content
ggplot2 3.4.4
 * Reference
 * News
   
   RELEASES
   
   Version 3.3.0 Version 3.2.0 Version 3.1.0 Version 3.0.0 Version 2.2.0 Version
   2.1.0 Version 2.0.0 Version 1.0.0
   
   Changelog
 * Articles
   Aesthetic specifications
   
   
   DEVELOPER
   
   Extending ggplot2 Using ggplot2 in packages Profiling Performance
   
   
   FAQ
   
   FAQ: Axes FAQ: Faceting FAQ: Customising FAQ: Annotation FAQ: Reordering FAQ:
   Barplots
 * Extensions


 * 


GGPLOT2


OVERVIEW

ggplot2 is a system for declaratively creating graphics, based on The Grammar of
Graphics. You provide the data, tell ggplot2 how to map variables to aesthetics,
what graphical primitives to use, and it takes care of the details.


INSTALLATION

# 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")


CHEATSHEET




USAGE

It’s hard to succinctly describe how ggplot2 works because it embodies a deep
philosophy of visualisation. However, in most cases you start with ggplot(),
supply a dataset and aesthetic mapping (with aes()). You then add on layers
(like geom_point() or geom_histogram()), scales (like scale_colour_brewer()),
faceting specifications (like facet_wrap()) and coordinate systems (like
coord_flip()).

library(ggplot2)

ggplot(mpg, aes(displ, hwy, colour = class)) + 
  geom_point()




LIFECYCLE



ggplot2 is now over 10 years old and is used by hundreds of thousands of people
to make millions of plots. That means, by-and-large, ggplot2 itself changes
relatively little. When we do make changes, they will be generally to add new
functions or arguments rather than changing the behaviour of existing functions,
and if we do make changes to existing behaviour we will do them for compelling
reasons.

If you are looking for innovation, look to ggplot2’s rich ecosystem of
extensions. See a community maintained list at
https://exts.ggplot2.tidyverse.org/gallery/.


LEARNING GGPLOT2

If you are new to ggplot2 you are better off starting with a systematic
introduction, rather than trying to learn from reading individual documentation
pages. Currently, there are three good places to start:

 1. The Data Visualisation and Graphics for communication chapters in R for Data
    Science. R for Data Science is designed to give you a comprehensive
    introduction to the tidyverse, and these two chapters will get you up to
    speed with the essentials of ggplot2 as quickly as possible.

 2. If you’d like to take an online course, try Data Visualization in R With
    ggplot2 by Kara Woo.

 3. If you’d like to follow a webinar, try Plotting Anything with ggplot2 by
    Thomas Lin Pedersen.

 4. If you want to dive into making common graphics as quickly as possible, I
    recommend The R Graphics Cookbook by Winston Chang. It provides a set of
    recipes to solve common graphics problems.

If you’ve mastered the basics and want to learn more, read ggplot2: Elegant
Graphics for Data Analysis. It describes the theoretical underpinnings of
ggplot2 and shows you how all the pieces fit together. This book helps you
understand the theory that underpins ggplot2, and will help you create new types
of graphics specifically tailored to your needs.


GETTING HELP

There are two main places to get help with ggplot2:

 1. The RStudio community is a friendly place to ask any questions about
    ggplot2.

 2. Stack Overflow is a great source of answers to common ggplot2 questions. It
    is also a great place to get help, once you have created a reproducible
    example that illustrates your problem.


LINKS

 * View on CRAN
 * Browse source code
 * Report a bug
 * Learn more
 * Extensions


LICENSE

 * Full license
 * MIT + file LICENSE


COMMUNITY

 * Contributing guide
 * Code of conduct


CITATION

 * Citing ggplot2


DEVELOPERS

 * Hadley Wickham
   Author
 * Winston Chang
   Author
 * Lionel Henry
   Author
 * Thomas Lin Pedersen
   Author, maintainer
 * Kohske Takahashi
   Author
 * Claus Wilke
   Author
 * Kara Woo
   Author
 * Hiroaki Yutani
   Author
 * Dewey Dunnington
   Author
 * 
   Copyright holder, funder

Developed by Hadley Wickham, Winston Chang, Lionel Henry, Thomas Lin Pedersen,
Kohske Takahashi, Claus Wilke, Kara Woo, Hiroaki Yutani, Dewey Dunnington, .

Site built with pkgdown 2.0.7.