# >
Color
- Using the
mtcars
data, create a scatterplot of the fuel efficiency as a function of weight with color based on the number of cylinders.
- Repeat the scatterplot but use
scale_color_brewer()
to set the palette to Set1.
# >
Why did you use
scale_color_brewer()
notscale_fill_brewer()
orscale_color_distiller()
?Repeat scatterplot #1 but use
scale_color_manual()
to set the three colors to red, green, and blue.
# >
- Find three colors (either names or hex codes), and repeat scatterplot #4 with your own colors.
# >
- 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.
# >
- Create a new column in
mtcars
that centers and scales displacement with thescale()
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.
# >