Color

Author

Jeffrey R. Stevens

Published

April 7, 2023

  1. Using the mtcars data, create a scatterplot of the fuel efficiency as a function of weight with color based on the number of cylinders.
# >
  1. Repeat the scatterplot but use scale_color_brewer() to set the palette to Set1.
# >
  1. Why did you use scale_color_brewer() not scale_fill_brewer() or scale_color_distiller()?

  2. Repeat scatterplot #1 but use scale_color_manual() to set the three colors to red, green, and blue.

# >
  1. Find three colors (either names or hex codes), and repeat scatterplot #4 with your own colors.
# >
  1. Using the mtcars data, create a scatterplot of the fuel efficiency as a function of weight with color based on horsepower using the BuPu palette and reverse the direction of the gradient.
# >
  1. Create a new column in mtcars that centers and scales displacement with the scale() function. Create a scatterplot of fuel efficiency as a function of weight with color based on the rescaled displacement, using a diverging scale of your choice.
# >