Enter your name and EID here

This homework is due on Feb. 15, 2021 at 11:00pm. Please submit as a pdf file on Canvas.

Problem 1: (5 pts) We will work with the midwest dataset provided by ggplot2. See here for details: https://ggplot2.tidyverse.org/reference/midwest.html

For the following plot, add an appropriate color scale from the colorspace package and explicitly set the palette you want to use. Also add an appropriate theme that works well with the color scale you have chosen. Explain in 2-3 sentences your choice of color scale and theme.

ggplot(midwest, aes(popdensity, percollege, fill = state)) +
  geom_point(shape = 21, size = 2.5, color = "white", stroke = 0.5) +
  scale_x_log10(name = "population density") +
  scale_y_continuous(name = "percent college educated") +
  scale_fill_discrete_qualitative(palette = "Dark3") +

We need a scale for the fill aesthetic, and the state variable is discrete and unordered. Therefore, we need a discrete, qualitative color scale, i.e., scale_fill_discrete_qualitative(). I picked palette “Dark3” because it is overall the darkest palette available, and it makes the points stand out from the background. I chose theme_minimal_grid() because it is very minimal and helps the data points stand out.

Problem 2: (2 pts) The following is a plot of the diamonds dataset provided by ggplot2. See here for details: https://ggplot2.tidyverse.org/reference/diamonds.html

ggplot(diamonds, aes(carat, price, color = cut)) +