Activity: Using Themes and Color Differentiation in a Plot

Steps for Completion:

  1. Make a scatterplot of female versus male BMIs.
  2. Build your plot in layers, to avoid creating three separate plots.
    1. Create the default plot. Store this plot as p1.
    2. Points should be differentiated by color. Differentiate the two BMIs by country using color. The size of the points should be 2.
    3. Change the color scheme by using scale_color_brewer. The palette used is Dark2. Store this plot as p2.
    4. Add a plot title: BMI female vs BMI Male.
    5. Change more of the theme's aspects to produce plot p3. The theme aspects to be changed, and their values, are as follows:
      • Panel Background: azure; Color: black
      • No grid lines
      • Axis Title Size: 15; Axis Title Color: cadetblue4
      • Change ...

Get Applied Data Visualization with R and ggplot2 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.