Changing one geom or every geom
If you have multiple geoms, then mapping an aesthetic to data variable inside the call to ggplot()
will change all the geoms. It is also possible to make changes to individual geoms by passing arguments to the geom_*()
functions.
geom_point()
has an alpha
argument that controls the opacity of the points. A value of 1
(the default) means that the points are totally opaque; a value of 0
means the points are totally transparent (and therefore invisible). Values in between specify transparency.
The plot you drew last time is provided in the script.
This exercise is part of the course
Introduction to Data Visualization with ggplot2
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Map the color aesthetic to clarity
ggplot(diamonds, aes(carat, price)) +
geom_point() +
geom_smooth()