- Notifications
You must be signed in to change notification settings - Fork2.1k
An implementation of the Grammar of Graphics in R
License
Unknown, MIT licenses found
Licenses found
tidyverse/ggplot2
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
ggplot2 is a system for declaratively creating graphics, based onTheGrammar ofGraphics. Youprovide the data, tell ggplot2 how to map variables to aesthetics, whatgraphical primitives to use, and it takes care of the details.
# 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")
It’s hard to succinctly describe how ggplot2 works because it embodies adeep philosophy of visualisation. However, in most cases you start withggplot(), supply a dataset and aesthetic mapping (withaes()). Youthen add on layers (likegeom_point() orgeom_histogram()), scales(likescale_colour_brewer()), faceting specifications (likefacet_wrap()) and coordinate systems (likecoord_flip()).
library(ggplot2)ggplot(mpg, aes(displ,hwy,colour=class))+ geom_point()
ggplot2 is now 18 years old and is used by hundreds of thousands ofpeople to make millions of plots. That means, by-and-large, ggplot2itself changes relatively little. When we do make changes, they will begenerally to add new functions or arguments rather than changing thebehaviour of existing functions, and if we do make changes to existingbehaviour we will do them for compelling reasons.
If you are looking for innovation, look to ggplot2’s rich ecosystem ofextensions. See a community maintained list athttps://exts.ggplot2.tidyverse.org/gallery/.
If you are new to ggplot2 you are better off starting with a systematicintroduction, rather than trying to learn from reading individualdocumentation pages. Currently, there are several good places to start:
TheData Visualization andCommunication chapters inRfor Data Science. R for Data Science isdesigned to give you a comprehensive introduction to thetidyverse, and these two chapters will getyou up to speed with the essentials of ggplot2 as quickly aspossible.
If you’d like to take an online course, tryData Visualization in RWithggplot2by Kara Woo.
If you’d like to follow a webinar, tryPlotting Anything withggplot2 by Thomas Lin Pedersen.
If you want to dive into making common graphics as quickly aspossible, I recommendThe R GraphicsCookbook by Winston Chang. It provides aset of recipes to solve common graphics problems.
If you’ve mastered the basics and want to learn more, readggplot2:Elegant Graphics for Data Analysis. Itdescribes the theoretical underpinnings of ggplot2 and shows you howall the pieces fit together. This book helps you understand thetheory that underpins ggplot2, and will help you create new types ofgraphics specifically tailored to your needs.
For articles about announcements and deep-dives you can visit thetidyverse blog.
There are two main places to get help with ggplot2:
ThePosit Community (formerly RStudioCommunity) is a friendly place to ask any questions about ggplot2.
StackOverflowis a great source of answers to common ggplot2 questions. It is alsoa great place to get help, once you have created a reproducibleexample that illustrates your problem.
About
An implementation of the Grammar of Graphics in R
Topics
Resources
License
Unknown, MIT licenses found
Licenses found
Code of conduct
Contributing
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Uh oh!
There was an error while loading.Please reload this page.

