4.1 Grammar
- Grammar answers question: What is a statistical graphic?
- “The Grammar of Graphics” (Wilkinson 2013)20
- “A Layered Grammar of Graphics” (Wickham 2010b)21
- Good grammar (Wickham 2010b, 3)
- provides insights into the composition of complicated graphics
- reveals unexpected connections between seemingly different graphics
- is just the first step in creating a good sentence
- Grammar tells us that (Wickham 2016)
- a statistical graphic is a mapping from data to aesthetic attributes (color, shape, size) of geometric objects (points, lines, bars)
- Plot may contain statistical transformations/is drawn on specific coordinate system
- Faceting used to generate the same plot for different subsets of the dataset.
- Combination of these independent components that make up a graphic
- Possibility of grammatically correct but nonsensical graph
- Grammar = conceptually useful even if you don’t use Ggplot2 (e.g., if you use Plotly)
References
Wickham, Hadley. 2010b. “A Layered Grammar of Graphics.” J. Comput. Graph. Stat. 19 (1): 3–28.
Wickham, Hadley. 2016. Ggplot2: Elegant Graphics for Data Analysis. Springer.
Wilkinson, Leland. 2013. The Grammar of Graphics. Springer Science & Business Media.