Coding for Graphics and a BBC House Style

Since I discovered the ggplot2 R graphics package, and read Leland Wilkinson’s The Grammar of Graphics book that underpins its design philosophy, it’s hugely influenced the way I think about the creation of custom graphics.

The separation of visual appearance from the underlying graphical model is very powerful. The web works in a similar way: the same HTML coded website can presented in a myriad different ways by the application of different CSS styles, without making any changes to the underlying HTML at all. Check out the CSS Zen Garden for over 200 examples of the same web content, presented differently using CSS styling.

A recent blog post by the BBC Visual and Data Journalism team — How the BBC Visual and Data Journalism team works with graphics in R — suggests they had a similar epiphany:

In March last year, we published our first chart made from start to finish using ggplot2.

Since then, change has been quick.

ggplot2 gives you far more control and creativity than a chart tool and allows you to go beyond a limited number of graphics. Working with scripts saves a huge amount of time and effort, in particular when working with data that needs updating regularly, with reproducibility a key requirement of our workflow.

In short, it was a game changer, so we quickly turned our attention to how best manage this newly-discovered power.

The approach they took was to create a cookbook in which to collect and curate useful recipes for creating particular types of graphic: you can find the BBC R Cookbook here.

The other other thing they did was create a BBC News ggplot2 house style: bbplot.

At the OU, where graphics production is still a cottage industry involving academics producing badly drawn sketches that get given to artists who return proper illustrations in a house style that need a tweak here or a tweak there communicated by the author making red pen annotations to printed out versions of the graphic etc etc, I keep on wondering why we don’t use powerful code based graphics packages for writing diagrams, and why we don’t have a house style designed for use with them.

PS by the by, via Downes, a post on The Secret Weapon to Learning CSS, that references another post on Teaching a Correct CSS Mental Model by asking what are “the mental patterns: ways to frame the problem in our heads, so we can break problems into their constituent parts and notice recurring patterns” that helps a CSS designer ply their craft. Which is to say: what are the key elements of The Grammar of Webstyle?

Author: Tony Hirst

I'm a Senior Lecturer at The Open University, with an interest in #opendata policy and practice, as well as general web tinkering...

%d bloggers like this: