Grammar of Graphics with ggplot2
ggplot2 Bar Chart
ggplot() Initializes a ggplot Object
In ggplot2 geom aesthetics are data-driven instructions that determine the visual properties of an individual geom.
Geom aesthetics allow individual layers of a visualization to have their own aesthetic mappings. These aesthetic mappings can vary depending on the geom.
For example, the
geom_point() geom can color-code the data points on a scatterplot based on a property with the following code:
viz <- ggplot(data=airquality, aes(x=Ozone, y=Temp)) + geom_point(aes(color=Month)) + geom_smooth()
The code above would only change the color of the point layer, it would not affect the color of the smooth layer since the
aes() aesthetic mapping is passed at the point layer.