The Grammar of Graphics

Published on Sunday, September 11, 2016 by Milos Gregor


The Stagraph software is based on a deeper theory prepared by Leland Wilkinson (1999), which he called Grammar of Graphics. Grammar of Graphics is a logical construction for statistical graphics definition in a few easy steps. If you use a tool based on the Grammar of Graphics, you will find the environment and work is fundamentally different from other classical tools.

In their description you will not find a finite number of charts that you can create. Using this methodology, you can create any chart type and you can freely combine them. For beginning is required to understand only a few basic principles. For example, there is nothing like a pie chart, but you can create a stacked bar chart in the polar coordinate system.

If you have your data in tabular form, each data column can be mapped to visual object in the chart. For example you define table columns that will be mapped to X and Y axis. Then you define used geometry. If you use points, these appear at the given coordinates. If you use box plot geometry, defined coordinates are statistically processed and converted to box plot position. Next, you can define the colour of geometric objects either as a static value or you can map color to values in data table.

In addition to colors, you can use as scale multiple properties, such as transparency, size, rotation or shape. In this way, it is possible to easy and quickly create any type of chart. In addition to the described geometry objects you can to graph insert other objects and features, but these will be described later with real examples.

The role of this post is to briefly describe the grammar of graphics theory. If you want to know more, I recommend looking at Wilkinson’s book, which is very well written and often humorous.

The following video shows the way how statistical graphics is created in the case you are using the Grammar of Graphics.