Lab 3



Lab Assignments

Overview

The purpose of this lab is to use color to your advantage. You will be asked to use a variety of color palettes, and use color for its three main purposes: (a) distinguish groups from each other, (b) represent data values, and (c) highlight particular data points.

Data

We’ll be working with the honey production data from #tidytuesday. The #tidytuesday repo contains the full data, but we’ll work with just the cleaned up version, using the honeyproduction.csv file, which is posted in the data folder in the course repo (i.e., if you pull for the most recent changes, you should have the data).

Assignment

  1. Visualize the total production of honey across years by state Use color to highlight the west coast (Washington, Oregon, and California) with a different color used for each west coast state.
  1. Reproduce the plot according to three different kinds of color blindness, as well as a desaturated version.
  2. Reproduce the plot using a color blind safe palette.
  3. Download the file here denoting the region and division of each state.
  1. Create a heatmap displaying the average honey production across years by region (averaging across states within region).
  2. Create at least one more plot of your choosing using color to distinguish, represent data values, or highlight. If you are interested in producing maps, I suggest grabbing a simple features data frame of the US using the Albers projection by doing the following:
remotes::install_github("hrbrmstr/albersusa")
library(albersusa)
us <- usa_sf()

You can then join your honey data with this dataset. We’ll talk about geographic data more later in the course, but it is pretty easy to work with. For example, you could use the data frame above to create a map of the US with:

library(ggplot2)
ggplot(us) +
  geom_sf()

You could, of course, theme it more from there, but if you join it with your honey data, you should be able to fill and/or facet by specific variables.

Note - this is a little trickier than it initially seems because you can “lose” states in your map if they don’t have any data (there are only 44 states represented in your honey dataset). You should still plot all states, but just have them not be filled according to your fill scale if there is no data.

Finishing up

When you have finished the above, upload your rendered (knit) HTML file to canvas.