Updated materials are available at https://github.com/nuitrcs/r_ggplot_july2018.
This workshop focuses on ggplot2
for making plots in R. The workshop also briefly covers plotly
.
This workshop also makes use of other tidyverse
packages for data manipulation and transformation.
Workshop Code: You'll probably want to download the RMarkdown and follow along, executing the commands in R.
Exercises (html):
Exercises with answers:
The workshop materials use data on baby names from the Social Security Administration. The data includes a sex variable. The workshop materials try to stick to "sex" as used in the original data. If we've slipped up and confused sex and gender, or you have suggestions for how we might better deal with sex and gender in an inclusive way, please let us know.
See additional resources and links to some visualization examples in the main R workshop repository.
ggplot
Cheat Sheet: you'll want to have this for reference
R Graph Gallery for ggplot
ggplot
Data Visualization Vocabulary from Jesse Maegan: confused by unfamiliar terms in the ggplot
help and functions? You can find explanations of many of them here.
ggplot
Tutorial from Sean Anderson, University of Washington
ggplot
Tutorial From the Harvard IQSS Data Science Services group.
Getting started with data visualization in R using ggplot
from Martin Frigaard at Storybench
ggplot
Tutorial from Selva Prabhakaran with examples of many different kinds of plots
An introduction to ggplot2 by Melanie Frazier, shows lots of color/style options along with a good general overview of ggplot
Software Carpentry: R for Reproducible Scientific Analysis: course material for introductory R workshop, includes a section on ggplot
Swirl: Interactive tutorials that you run in R. The Exploratory Data Analysis course includes sections on ggplot
.
ggplot2
Elegant Graphics for Data Analysis by Hadley Wickam, who wrote the package. The book can also be downloaded as a pdf by going through the Library. The book's code is here.
R for Data Science: free online book using the tidyverse
of packages, has a chapter on data visualization. It includes a chapter on Graphics for communication which doesn't teach ggplot
so much as give you good principles of making charts with it.
Data Visualization for Social Science: by Kieran Healy, an online book that uses ggplot
Plotly for R by Carson Sievert
A comparison on Base graphics and ggplot from Flowing Data, which is a great site in general for R graphics, but he doesn't use ggplot
.
Stack Overflow: great for searching for issues; most questions you have will have already been asked by someone else; be aware of the date of answers, as sometimes an answer may be a little out of date.
colorblindr: package to help you check what your plots might look like to someone who is colorblind