ABSTRACT

This chapter illustrates how the ggplot2 package can be used to create data graphics. Authors employ the ggplot2 system because it provides a unifying framework-a grammar-for describing and specifying graphics. The grammar for specifying graphics will allow the creation of custom data graphics that support visual display in a purposeful way. In the grammar of ggplot2, an aesthetic is an explicit mapping between a variable and the visual cues that represent its values. In this case, this means that any variables mentioned anywhere in the plot are understood to be within the CIACountries data frame, since the authors have specified that in the data argument. Every data scientist should know how to make and interpret these canonical data graphics-they are ignored at your peril.