A Layered Grammar of Graphics

A grammar of graphics is a tool that enables us to concisely describe the components of a graphic. Such a grammar allows us to move beyond named graphics (e.g., the “scatterplot”) and gain insight into the deep structure that underlies statistical graphics. This article builds on Wilkinson, Anand, and Grossman (2005), describing extensions and refinements developed while building an open source implementation of the grammar of graphics for R, ggplot2. The topics in this article include an introduction to the grammar by working through the process of creating a plot, and discussing the components that we need. The grammar is then presented formally and compared to Wilkinson’s grammar, highlighting the hierarchy of defaults, and the implications of embedding a graphical grammar into a programming language. The power of the grammar is illustrated with a selection of examples that explore different components and their interactions, in more detail. The article concludes by discussing some perceptual issues, and thinking about how we can build on the grammar to learn how to create graphical “poems.” Supplemental materials are available online.

[1]  W. Cleveland,et al.  Graphical Perception: Theory, Experimentation, and Application to the Development of Graphical Methods , 1984 .

[2]  S. Klinke,et al.  Exploratory Projection Pursuit , 1995 .

[3]  A. Hughes Oxford English Dictionary. , 2008, Isis; an international review devoted to the history of science and its cultural influences.

[4]  Michael Friendly,et al.  Effect ordering for data displays , 2003, Comput. Stat. Data Anal..

[5]  William S. Cleveland,et al.  A Model for Studying Display Methods of Statistical Graphics , 1993 .

[6]  Hadley Wickham,et al.  Practical tools for exploring data and models , 2008 .

[7]  Kristian Skrede Gleditsch,et al.  Graphic Discovery: A Trout in the Milk and Other Visual Adventures , 2006 .

[8]  John J. Bertin,et al.  The semiology of graphics , 1983 .

[9]  John Price-Wilkin,et al.  Oxford English Dictionary (2nd ed.) , 1991 .

[10]  Heike Hofmann Constructing and reading mosaicplots , 2003, Comput. Stat. Data Anal..

[11]  John Alan McDonald,et al.  Variable Resolution Bivariate Plots , 1997 .

[12]  J. A. Hartigan,et al.  Mosaics for Contingency Tables , 1981 .

[13]  John M. Chambers,et al.  Graphical Methods for Data Analysis , 1983 .

[14]  Robert McGill,et al.  Graphical Perception: The Visual Decoding of Quantitative Information on Graphical Displays of Data , 1987 .

[15]  Heike Hofmann,et al.  Interactive Graphics for Data Sets with Missing Values—MANET , 1996 .

[16]  Daniel B. Carr,et al.  Scatterplot matrix techniques for large N , 1986 .

[17]  Pedro M. Valero-Mora,et al.  ggplot2: Elegant Graphics for Data Analysis , 2010 .

[18]  Jeffrey Heer,et al.  Multi-Scale Banking to 45 Degrees , 2006, IEEE Transactions on Visualization and Computer Graphics.

[19]  Richard A. Becker,et al.  The Visual Design and Control of Trellis Display , 1996 .

[20]  Mark Bailey,et al.  The Grammar of Graphics , 2007, Technometrics.

[21]  David R. Cox,et al.  Some Remarks on the Role in Statistics of Graphical Methods , 1978 .

[22]  R. Grossman,et al.  Graph-theoretic scagnostics , 2005, IEEE Symposium on Information Visualization, 2005. INFOVIS 2005..

[23]  Dianne Cook,et al.  Grand Tours, Projection Pursuit Guided Tours, and Manual Controls , 2008 .