Complete the code to create a scatter plot using ggplot2.
ggplot(data = mtcars, aes(x = wt, y = mpg)) + geom_[1]()The correct function to add points in ggplot2 is geom_point(). You only write point inside geom_ to complete the function name.
Complete the code to map the color aesthetic to the 'cyl' variable.
ggplot(mtcars, aes(x = wt, y = mpg, color = [1])) + geom_point()To color points by the number of cylinders, use the variable cyl inside the aes() function.
Fix the error in the code by completing the function name correctly.
ggplot(mtcars, aes(x = wt, y = mpg)) + geom_[1]()The correct function to add points is geom_point(). You only fill in 'point' after 'geom_'.
Fill both blanks to create a scatter plot with size mapped to 'hp' and shape mapped to 'cyl'.
ggplot(mtcars, aes(x = wt, y = mpg, size = [1], shape = [2])) + geom_point()
To map size to horsepower, use hp. To map shape to cylinders, use cyl.
Fill all three blanks to create a scatter plot with color mapped to 'gear', size to 'hp', and shape to 'cyl'.
ggplot(mtcars, aes(x = wt, y = mpg, color = [1], size = [2], shape = [3])) + geom_point()
Color is mapped to 'gear', size to 'hp', and shape to 'cyl' to create a detailed scatter plot.