
Artwork by Allison Horst
Pre-class Prep
A. Install required packages
install.packages("monochromeR") # a package for creating monochrome color palettes and easily converting rgba values to hex codes (and also some other useful functions)
install.packages("showtext") # for using fonts more easily in R graphs
install.packages("glue") # for string interpolation (aka helps us insert variables directly into text strings)
install.packages("ggtext") # improved text rendering support for ggplot2
install.packages("ggrepel") # ggplot2 extension to repel overlapping labels
install.packages("googlesheets4") # provides an R interface to Google Sheets via the Sheets API v4B. Download Data
In case we have trouble with the {googlesheets4} API, you can download and read in the following data files as normal (i.e. using readr::read_csv()):
If you choose (or need) to download and read in these files, be sure to save them to your class repo at ~/week6/data/.
C. Download Font Awesome fonts
We’ll learn how to use Font Awesome icons in our ggplots. To do so, you’ll need to download the Font Awesome font files and save them to your class repo. Do so by following these steps:
- Download Font Awesome fonts: Go to https://fontawesome.com/download and download the latest release available. Choose the Free For Desktop option.
- Unzip the downloaded file: You should see a folder inside called
otfs/– this contains three.otffiles (aka OpenType font format files) - Copy the three
.otffiles to your class repo: I recommend creating afonts/folder inside your root directory, and dropping all three of them in there (e.g.EDS-240-data-viz-examples/fonts/*.otf)
D. Download .qmd templates & review data wrangling code
Download all necessary templates (links in the table below) and save them to a
EDS-240-data-viz-examples/week6/folder.Review setup / wrangling / base plot code and make note of any questions you might have. Due to time constraints, we won’t be live-coding our way through all code in class. However, we’ll reserve some time to answer any questions before we jump into data viz . Specifically:
- Template 6.1 begins where we left off in creating our salary plot (in lecture 4.1). Review the code under the
## Setup,## Wrangle Dataand## Recreate original plotsections to re-familiarize yourself.
- Template 6.2 includes setup and base plot code for two different visualizations (one using lobster data, another using Mono Lake data). Review the
### Setupand### Create base plotsections for both these visualizations.
- Template 6.1 begins where we left off in creating our salary plot (in lecture 4.1). Review the code under the
Lecture Materials
| Lecture slides | Code-along template | Code-along key |
|---|---|---|
| Lecture 6.1: typography | 6.1 template | 6.1 key |
| Lecture 6.2: annotations | 6.2 template | 6.2 key |
Pre-discussion Prep
A. Prepare a week6-discussion.qmd file
Add a new blank file to your class repo at the following location:
EDS-240-class-examples/week6/week6-discussion.qmd.Fill out the necessary YAML information (title, author, date + any other information you find helpful).Copy over the contents from your
TEMPLATE-lecture6.1-typography.qmdfile – we’ll be iterating on this code during discussion section.
Discussion Materials
| Discussion Slides | Exercise instructions | Exercise solutions |
|---|---|---|
| D6 slides: saving plots | see pre-discussion prep | see D6 slides |
Assignment Reminders
| Assignment Type | Assignment Title | Date Assigned | Date Due |
|---|---|---|---|
| EOC | EOC (week 6) | Mon 02/10/2025 | Mon 02/10/2025, 11:55pm PT |
| HW | Homework Assignment #3 | Tue 02/11/2025 | Tue 02/25/2025, 11:59pm PT |