Summary
In this chapter, we introduced essential graphics techniques based on the ggplot2
package. We started by going over the basic scatter plot and learned the grammar of developing layers in a plot. To build, edit, and improve a plot, we need to specify three essential layers: data, aesthetics, and geometries. For example, the geom_point()
function used to build a scatter plot allows us to control the size, shape, and color of the points on a graph. We can also display them as text in addition to presenting points using the geom_text()
function.
We also covered the layer-specific control provided by the geometry layer and showed examples using bar charts and line plots. A bar chart can help represent the frequency distribution of categorical variables and the histogram of continuous variables. A line chart supports time series data and can help identify trends and patterns if appropriately plotted.
Finally, we also covered the theme layer, which allows us to control all non...