Plotting¶
Learning outcomes
- I am comfortable with the first chapter of R for Data Science
- I can use
ggplot2to create a simple plot - I can save a plot created by
ggplot2 - I can tell what
ggplot2aesthetics are - I can tell what
ggplot2geometrical objects are
For teachers
Teaching goals are:
- Learners have read part of the first chapter of R for Data Science
- Learners have created simple plots in
ggplot2 - Learners can create simple ggplots from tidy data
- Learners can set the aesthetics
x,yandcolor - Learners can use
geom_scatter,geom_boxplotandgeom_smoothfor simple aesthetics
Prior question:
- What is the most used use R package for plotting?
- What is
gginggplot2? - What is tidy data?
- There is a philosophy that 'missing values should never silently go missing'. What does that mean?
Feedback questions:
- What is
gginggplot2? - What is tidy data?
- What is an aesthetic?
- What is a
geom? - The philosophy that 'missing values should never silently go missing'. What does this mean?
Why ggplot2 is important¶

ggplot2 allows you to create publication-quality graphs for your paper,
using a unified (and extensible) grammar,
which allows you to express your unique
plotting needs.
Additionally,
ggplot2 is the CRAN package with the most downloads per month.
Exercises¶
Exercise 1: your first ggplot2 plots¶
- Read R for data science, chapter 1 until the exercises of 1.2.5
- Do all exercises of 1.2.5
Exercise 2: saving your plots¶
- Read R for data science, chapter 1 until the exercises of 1.6.1
- Do all exercises of 1.6.1.
(optional) Exercise 3: different type of data, different type of plot¶
- Read R for data science, chapter 1 until the exercises of 1.4.3.
- Do all exercises of 1.4.3
(optional) Exercise 4: expressing relations in color, fill and facets¶
- Read R for data science, chapter 1 until the exercises of 1.5.5
- Do all exercises of 1.5.5