Exercise

Getting rid of unnecessary color

You might want to compare the relationship CO to NO2 values across cities using a simple scatter plot with color to differentiate the different cities' data.

Scatter plot of CO and NO2 with lots of overlapping plots

Unfortunately, the resulting plot is very convoluted. It's hard to make out differences between the cities because one has to differentiate between similar colors. It turns out that sometimes the best color palette for your plot is no color at all.

To remedy this hard-to-read chart, get rid of the color component and facet by each city. While the resulting plot may not be as pretty, it will be a much better tool to decipher the differences.

Instructions

100 XP
  • To set up a chart faceted by the city, pass the plotting function the pollution data, map the city to the columns, and make the facet three columns wide.
  • Use the g.map() function to map a scatterplot() over our grid with the same aesthetic as the original scatter but without the hue argument.