| Time | Content |
|---|---|
| 10:00–10:30 | Drawing plots with ggplot2 |
| 10:30–11:00 | Exercise 1 |
| 11:00–11:30 | The Grammar of Graphics |
| 11:30–11:40 | Break |
| 11:40–12:10 | Exercise 2 |
| 12:10–12:30 | Drawing multiple layers with ggplot2 |
| 12:30–12:50 | Exercise 3 |
| 12:50–13:00 | Wrap up |
ANU BDSI
workshop Data Visualisation with R Part 1
Biological Data Science Institute
10th April 2024
https://emitanaka.org @statsgen fosstodon.org/@emitanaka
All materials will be hosted at
https://anu-bdsi.github.io/workshop-data-vis-R1/
| Time | Content |
|---|---|
| 10:00–10:30 | Drawing plots with ggplot2 |
| 10:30–11:00 | Exercise 1 |
| 11:00–11:30 | The Grammar of Graphics |
| 11:30–11:40 | Break |
| 11:40–12:10 | Exercise 2 |
| 12:10–12:30 | Drawing multiple layers with ggplot2 |
| 12:30–12:50 | Exercise 3 |
| 12:50–13:00 | Wrap up |
ggplot2
ggplot2
ggplot2ggplot2
ggplot2
ggplot2ggplot2 R packageggplot2 R package is part of the tidyverse suite of R packagesggplot2 is widely used by the scientific community and even by news outlets (e.g. Financial Times and BBC)ggplotdata.frame
geom_histogram()geom_density()stat_ecdf()stat_qq()geom_boxplot()geom_violin()geom_jitter()penguins data is from the palmerpenguins 📦
geom_histogram()geom layers in ggplot2stat layers in ggplot2
geom_point()geom_smooth()geom_bin2d()geom_hex()geom_line()vignette("ggplot2-specs")
?geom_point).x and y
alpha
color
fill
size
geom_point()shape
stroke vs size
stroke and fill is only for the “filled” shapes.color
linetype
linewidth
lineend
linejoin
aes, it assumes that it’s a data variable."dodgerblue" gets converted into a variable with one level and it gets colored by ggplot’s default color palette.Don’t put attributes inside aes()!
I() operator to mean “as-is” in aesthetic mapping.ggplot() but not attributes.data.framegeom_ or stat_ functions) which describes what to renderggplot2 cheatsheet30:00 anu-bdsi.github.io/workshop-data-vis-R1/