Session Ready
Exercise

Coloring ordinal categories

You are working for the Des Moines city council to assess the associations of various pollutant levels in the city. The two most important pollutants are SO2 and NO2 but CO is also of interest. You've only been allowed enough space for a single plot for your part of the report.

You start with a scatter plot of the SO2 and NO2 values as they are most important and then decide to show the CO values using a color scale corresponding to CO quartiles. By binning the continuous CO values, you have turned CO into an ordinal variable that can illuminate broad patterns without requiring much effort from the viewer to compare subtly different shades.

Instructions
100 XP
  • Set the qcut() function to break 'CO' into quartiles.
  • Map the color of your scatter plot to the new quartile column.
  • Change the palette to the ColorBrewer palette 'GnBu'.