Developing a data visualisation style
This is the first in a series of posts charting the design choices, open source tools and analytical workflows that the Trafford Data Lab are adopting.
The Trafford Data Lab supports decision-making in Trafford, a local authority in Greater Manchester, by revealing patterns in data through visualisation. It is committed to publishing open data and using open source tools to encourage a transparent and reproducible analytical workflow.
Why develop a style?
Overall the charts are more harmonious. They look like a family. Each with different quirks, but similar genetic makeup. (Cesal, 2017)
Media outlets, governments and other organisations produce charts and graphs that follow in-house design standards to ensure a consistency of output that is instantly recognisable to audiences. For example, charts produced by FiveThirtyEight use the Atlas Grotesk typeface, have light grey backgrounds, short headline grabbing titles, and footers containing the logo and the data source. Even when you scroll through 52 of their ‘best and weirdest charts’ you know that they were all produced by FiveThirtyEight because they conform to a style.
Style guides are a set of standards that help everyone in an organisation to create consistent, high quality outputs. Style guides may be prescriptive about the typeface and colour palettes but often include good design practice for data visualisation.
For example, charts created by The Economist conform to a style guide that requires the adoption of the ITC Officina Sans typeface, a colour palette of neutral greys and blues and a filled red rectangle that stands in for The Economist logo. However, they also have short and occasionally amusing left-aligned titles with descriptive subtitles, thick white horizontal major gridlines, and y-axis labels on the right. The Economist use these design elements to forge a signature style that ensures charts are recognisably created by The Economist even when reproduced elsewhere.
Organisations use style templates to ensure that their employees adhere to design standards. They can also help to speed up the the visualisation production process. For example, the Financial Times use a tool called Nightingale which allows reporters to create charts that conform to the FT’s visual style. Users paste in their data and Nightingale suggests an appropriate visualisation e.g. a line chart with a typeface, palette and layout that follows the FT’s design standards.
FiveThirtyEight use the open-source R language to create a style template for their graphical outputs. Using the ggplot2 graphics package, they have developed a custom FiveThirtyEight ‘theme’ to style their charts (Flowers, 2016). The UK Government have also published a ggplot2 govstyle theme to ensure that their charts retain a consistent style.
(Free)styling with R
Creating you own charting style with R is relatively easy. The ggplot2 package allows users to modify elements of a plot and reuse them as a ‘theme’. The related dplyr package helpfully includes the starwars dataset that we can practice with.
Putting a theme together typically involves overriding an existing theme like the default theme_grey() …
and tweaking non-data elements like the background,
axis tick marks,
plot title and axis labels.
Once you are happy with your modifications you can save them as a theme object that you can apply to all of your chart outputs.
The Trafford Data Lab have drawn on the chart design standards of The Economist, Financial Times and FiveThirtyEight to develop our own style. Like FiveThirtyEight we’ve baked our style into a ggplot2 theme to ensure consistency in our outputs. Here is the same data styled with our theme_lab():
Written by Henry Partridge, Manager of the Trafford Data Lab
Cesal, Amy. ‘Why does Data Vis need a style guide?’, OpenVisConf 2017. 24 April 2017. https://youtu.be/0rQ0NP8JPHQ
Flowers, Andrew. ‘FiveThirtyEight’s Data Journalism Workflow with R’, useR! 2016 international R User conference, 15 June 2016. https://channel9.msdn.com/Events/useR-international-R-User-conference/useR2016/FiveThirtyEights-data-journalism-workflow-with-R
Wickham, Hadley. ggplot2: Elegant Graphics for Data Analysis. Springer-Verlag New York, 2016.