Week 4

Visualize your data

Reading

Optional

Overview

The brain is hardwired to detect patterns in images, and a well-crafted data visualization can take advantage of that fact to communicate lots of information in an aesthetically pleasing way. And it’s about more than communication. Charts can reveal patterns in data that summary statistics alone might miss, as the Datasaurus Dozen artfully reveals…

This week, we get deeper into building visualizations with the ggplot2 package (a part of the tidyverse). It will take some time to learn all of the function syntax, so be patient with yourself. Once you get the hang of it, you’ll have an endlessly flexible tool for exploring and communicating patterns in your data. Let’s get started.

Problem Set

Using one of the datasets we’ve been working with in class, submit a data visualization using ggplot. Your submission should:

  1. Communicate some interesting result
  2. Use more than one aesthetic
  3. Be easy to interpret at a glance (you can include a short caption – labs(caption = ...) – if you would like).
  4. Be reproducible; submit your figure as a .png file, plus the .R script that produced it.

Consider this a friendly competition! I will look through the sumbmissions and pick my favorites, and their creators will receive honor, glory, and adoration.


  1. Hadley is the author of ggplot, so he knows a trick or two.↩︎