Grammar of Graphics: Purpose and Challenges

Posted by Sarah Leichty

The Grammar of Graphics

The purpose of Leland Wilkinson’s chapter on the grammar of graphics is to create seven classes of groups of functions that are used to make graphs. The point of the seven groups is to have an innumerable amount of possible graphs produced from these different classes. A second purpose is to lend meaning behind building graphics based on data. The classes contain many paths within them that create an environment of limitless possibilities for plotting data.

Some challenges of using a grammar are that the data flow must be used correctly to avoid creating a meaningless graphic. Another challenge of using the grammar of graphics is that implementing the classes mentioned in a way that sticks with the methods of the functions can be difficult. Although the “orthogonality’ of the classes can be tested easily, this implementation process could be a struggle.

We have already used the grammar of graphics in this class by using relational databases stored using SQLite. Within the algebra class, cross is used instead of joins as a way to create new tables with records from various tables created in the first class, variable. We have used both SQLite and R to do joins on tables. R packages that we have used, such as ggplot, also produce graphs based on tables kept in a tidy format. While the format of these classes may be different, both programs can produce scatterplots, bar plots, and the like. Later in the article, the author makes a reference to several software systems based on the grammar of graphics foundation and one of them is the ggplot2 package developed by Hadley Wickham. The article states that it ‘implements many of the graphics …using a simple functional language”. After reading this article, it seems like the grammar of graphics has given birth to many programs aimed at efficiently turning objects in tables into easy-to-manipulate graphs of all sorts.