Week 3

Visualizing data and making maps with ggplot2

weeks
Published

February 11, 2025

Summary
Learn to make plots and maps using the {ggplot} package. Visualization is a key method in learning how to explore, tidy, and interpret data.

Overview

This week is all about making plots and maps using the {ggplot} package. Learning to visualize data is a great place for start learning how to exploring data analytically and understanding the value of tidy data when working with R.

Key Objectives

  • Introduce the concept of a “pipe” (%>% or |>) and how and when to use it
  • Introduce the concept of the “grammar of graphics”
  • Practice plotting and mapping data with ggplot2
  • Practice mapping data with mapview

Key Skills

  • Using keyboard shortcuts in RStudio
  • Creating plots using ggplot(), aes(), and geom_() functions
  • Creating static maps using geom_sf() and coord_sf()
  • Creating interactive maps using mapview()
  • Using theme_ functions to customize the appearance of a plot
  • Using labs() to add labels to a plot

Prepare

Required readings

Optional readings

Additional resources on data visualization and mapping with R:

Additional reading on data visualization:

  • Elliot Bentley “The Web as Medium for Data Visualization,” in The Data Journalism Handbook: Towards A Critical Data Practice, ed. Liliana Bounegru and Jonathan Gray, 2nd ed. (Amsterdam University Press, 2021), 138–142, doi:10.2307/j.ctv1qr6smr.29.

Additional resources on working with projects:

Participate

🖥️ Visualizing spatial data with {ggplot2}

Practice

🛠️️ Exercise 02