The grammar of graphics

Related Articles

Google Analytics 4

Is your business Google Analytics 4 ready?


A look at Google Tag Manager’s latest updates


The grammar of graphics

Hi everybody. Today I’m going to be talking about the grammar of graphics. If you’re wondering what that it is, let’s first define grammar.

What is grammar?

Grammar is the basic elements that make up an area of knowledge or skill. It’s the building blocks that allow us to communicate and describe a particular area of knowledge.

And we’re applying it specifically today around visualisation, and there’s been some phenomenal work in this area from like of Leland Wilkinson, and later on a guy called Hadley Wickham, who works at RStudio, who has kind of encoded this grammar of graphics into visualisation libraries, like ggplot. But today we’re going to be breaking apart what the grammar of graphics is and how we can use it to create powerful storytelling and good visualisations.

Good vs. bad data visualisation

But first, what is or what makes a good visualisation? Just going to go through a few little examples now. Ask yourself some questions about whether you think these are good visualisations.

Like this one. We’re looking at two pie charts: one from 2017 and one from 2018, and the kind of things I might want to ask myself here are: ‘how much does segment A grow year-on-year?’ ‘Which segments have changed the most?’ And, ‘what’s it likely to look like in 2019?’ And do you think this visualisation helps with that, does it assist that? Doesn’t really give that kind of cognition.

What about this next one here? There’s a lot going on There could be some really interesting stories behind that, some interesting information, but I’m not quite sure what I’m meant to be looking at here. Maybe this first one here’s particularly interesting? This green line dropping down there. But it doesn’t particularly jump out at me, I feel like I’m having to do a lot of the work to get to that conclusion.

What about this one? Do you think one’s a good illustration? Much better, yeah. So, here we’re looking at different decades, we’ve kind of… we’ve got colour, we’ve got saturation. The story here is fairly clear. In this particular example, carbon dioxide concentration by decade appears to be consistently increasing in a very predictable manor.

What about this one here? We’ve got: impression share and average rank on a single axis, investment versus coverage. I’m not quite sure what I’m looking at here if I might be honest.

And finally, what about this one? This one is ‘The anatomy of a winning ted talk’. We’ve got three dimension – it’s a three-dimensional pie chart by the looks of it. I don’t know what the percentages add up to, but I assume it’s 100%. And it looks like it’s got some interesting information next to it. It certainly looks nice, it catches the eye. I don’t know whether I’d say that makes it a good visualisation though, because it’s caught my attention, because there’s plenty of videos, images and pictures of people that would do exactly that.

What is the grammar of graphics?

So, the grammar of graphics is an attempt to formalise or create the vocabulary and the language and the building blocks of understanding to allow us to understand: what makes a good visualisation? What aids with cognition when you’re looking at visual imagery?

Amit Kapoor

So, a man named Amit Kapoor from narrativeVIZ, has created a kind of framework to begin talking about this. In his mind, he says you’ve got ‘data’, and you have ‘story’, and you have ‘visual’. And if you look at the overlaps in this Venn Diagram, you’ve got ‘tales’ and ‘graphs’ and ‘art’. And the real sweet spot with storytelling, with being able to convey information through visual imagery, lies right in the middle of these three. So, byr mastering these three skills, these three areas, we can create powerful visual imagery.

How to tell a story with graphics

So, to focus on story for just a moment. Good stories have shape, and it wouldn’t be a good data presentation without some research or data to back it up. So, I found a really interesting study that identified or found that there’s very strong supporting evidence for six key story arcs in Western literature.

So, you’ve got the rags to riches story up here, this is I believe, ‘Alice in Wonderland’ was the number one example of that. The ‘Man in a Hole’, ‘Cinderella’… and just to explain these, in each one you’ve got the beginning of the book and the end of the book, so you’re talking beginning, middle, end type stuff and how that trajectory looks. You can see there’s a variety of very popular story arcs in Western literature. Each line represents a single book, and it’s the, I believe the hundred closest matching books in each story.

So, with this in mind, if we’re storytelling with our work, and we want to captivate, how do we apply this to our own work? What about the ‘rags to riches tale of an award-winning SEO strategy’? Look at that, amazing. Rags to riches. And you remember this one? Look at the top left, rags to riches it’s exactly that.

What about this one? The ‘Cinderella content strategy’. We had some great success early on. But midnight strikes and everything goes downhill. But don’t worry, we have a lovely happy ending.

Imagery is more memorable

Storytelling can very much take a part of our work. So, moving on for a moment, the average adult reads at 300 words per minute. That sounds pretty fast, but that’s about one side of A4 every 80 seconds, every minute and a half, something like that. It’s not the quickest way of getting information in. A relatively recent study found that the brain can process images in as little as 13 milliseconds. It’s 0.03 of a second. It’s unbelievably quick. The brain is this enormous processing machine that just thrives on visual imagery.

Crafting visual stories with data

So, moving back to what Amit Kapoor was saying., again. He proposes that there’s seven different ways that we can think about imagery and how we present data through graphics. We’re going to be focusing on four of them today:

    1. Abstraction
    2. Representation
    3. Aesthetics
    4. Messaging

The other three tend to relate around motion and flow and sequence of imagery. We can cover those in a later talk.

So just to explain each of these: these are steps that I would kind of recommend that you follow through your process of data visualisation.


Start with abstraction, so it’s finding the story. Don’t go in thinking about what vision you’re going to create before you’ve explored the data. So, there’s lots of different types of things that you could find to create a story: you could have trends, you could have patterns, and you could have outliers. You put your data on a line graph, you put it in a scatter plot, you put it in a bar chart and so on. This is exploratory analysis at this stage. You’re looking for those interesting bits of information, the things that can later become insight.


Once you’ve found your story, you choose the representation. So, this is choosing the upmost powerful way to tell it. So, it’s picking the right visualisation that emphasises the point you’re trying to make. For example, time series data, things that have an axis of time, typically told very well with a line graph. Categorical data is told particularly with bar charts, for example. And you try out a few different visualisations to pick the one that really emphasises the story you’re trying to tell.


Next, you look at your Aesthetics. So, this is finding ways to make it compelling, to engage the user. You can use colour, you can use saturation, hue, contrast, you can remove elements, you can add elements, there’s a whole tonne of ways that we can use. But every single change you make to your visualisation should be done with the idea of emphasising the point you are trying to make. Don’t add extra colours just because it looks nice. If anything, remove colours to draw attention to what you’re trying to say.


And then finally, tell people what you’re trying to say anyway. No matter how much beautiful visualisation you put in there, narrate the story, add messaging. This can be anything from just describing what the finding is in your subject line, or the graph title, it can be adding arrows pointing to things, it can be vertical lines describing when certain events happened.

Key takeaways

So, if I have to give some few takeaways, things to take away and learn and apply to your own visualisation, it would be this slide here.

    • Use visualisation to enhance your message, don’t use visualisation to make the user work and try and understand what you’re saying. Tell them what you’re saying with visualisation.
    • You can do that through a process of exploratory analysis, choosing a suitable representation, applying the right aesthetics to emphasise your point, and then supporting your point with appropriate messaging.

And this is just scratching the surface of the grammar of graphics, it is a very well written about subject. If there’s any further reading you want to take out, you might recognise this first one, this is from Leland Wilkinson, who originally proposed ‘the grammar of graphics’. This one here by Cole, I believe, from Google, she’s done lots of work with them, very, very powerful book – particular favourite of mine, because you can read it and basically understand the entire this without reading a word, the visuals are that good that you can understand the book without reading a single word.

And thank you very much for listening.