An R package for graphics
part of the
tidyversedevelopped by Hadley Wickham
ggplot2Boris Hejblum & Loïc Ferrer
June 17th, 2019
ggplot2An R package for graphics
part of the tidyverse
developped by Hadley Wickham
2 principles
a graph is made of several layers
grammar (i.e. mathematical & esthetical rules) between layers
source:
| Layer | Description |
|---|---|
| Data | data to be displayed |
| Aesthetics | the variables that will be displayed |
| Geometries | the way the data will be displayed |
ggplotinitialize the data
add (at least) one geometry — with +
specify required Aesthetics — with aes()
xycolourfillsizealphalinetypelabelsshape37 different geometries…
geom_pointgeom_linegeom_tilegeom_barChosing colors is hard ! (as hard as naming things ?)
Be mindful of:
black and white
colorblinds (~10% of white men)
=> viridis
stop wasting time
ggplot2 practicalOpen BADAS4_practical.html and follow along…
Google, Stack-overflow, GitHub, Twitter, …