Vidyalelo
R Programming · Q16

Data Visualization with ggplot2

Programming · R Programming · question 16

Q16

In ggplot2, how do you add a color gradient to a scatter plot based on a numeric variable color_var?

A.
scale_fill_gradient(low = "blue", high = "red")
B.
color_gradient(low = "blue", high = "red")
C.
scale_color_gradient(low = "blue", high = "red")
Answer
D.
geom_point(aes(color = color_var), fill = "blue")

Answer: Option C

Solution

Answer: Option C
No explanation is given for this question Let's Discuss on Board