6) ggplot
π Lecture
Simply put: a graphic involves mapping data to geometric objects and their visual attributes. This is the underlying framework behind the mechanics and core functions available in "ggplot2"
for creating simple graphics:
- Begin your graphic specification with
ggplot()
- Indicate where the
data
comes from - Establish which variables are going to be mapped into visual attributes:
aes()
- Decide what kind of geometric object(s) will be used to display data; e.g.
geom_point()
- Optional: do you need to use facets?
- Optional: do you need to explicitly use one or more statistical transformations?
- Optional: do you need to explicitly set a non-default system of coordinates?
- Optional: do you need to explicitly use a non-default theme of graphical elements?
π― Objectives
At the end of this week you will be able to:
- Get a first contact with
"ggplot2"
- Describe the purpose of the aesthetic mapping function
aes()
- Describe the notion of βlayersβ and how to use them for making a graphic using
"ggplot2"
π Reading
π¬ Lab
Youβll learn how to create basic graphics with ggplot2 functions.