Data Visualisation

Data visualisation is essential for exploratory analysis, and for effectively communicating results.

Best Practices for Data Visualisation guidance for the Royal Statistical Society

Alongside Andreas Krause (Idorsia Pharmaceuticals) and Brian Tarran (Royal Statistical Society), I co-authored the Royal Statistical Society’s Best Practices for Data Visualisation guidance, published in July 2023. The guide covers both the art and the science of data visualisation. It is written primarily for contributors to Royal Statistical Society publications – chiefly, Significance magazine, the Journal of the Royal Statistical Society Series A, and Real World Data Science – but the information and advice within is of broad relevance and use to any data visualisation task. The guide can be viewed at rss.org.uk/datavisguide/.

Developing an R package

The guide also contains technical instructions for authors on how to edit the settings of their visualisation software to better style their graphics. The guide covers examples of doing so in R and Python (with examples added by the community for other software), with R being used often (both base R and {ggplot2}). To help authors with styling their charts to fit in with the guidance in this document, we have developed an R package, {RSSthemes}.

This R package:

  • Stores and load font files
  • Defines colour palettes with RSS colours
  • Creates theme_*() and scale_* functions for {ggplot2}
  • Sets (and unsets) different base R defaults

Let’s see an example in action! Let’s say you have simple data set that you want to use to make a bar chart with {ggplot2}

1
2
3
4
5
library(ggplot2)
plot_df <- data.frame(x = LETTERS[1:4], y = 1:4)
ggplot(data = plot_df,
       mapping = aes(x = x, y = y, fill = x)) +
  geom_col()

You can restyle it, using the {RSSthemes} package and two lines of code:

1
2
3
4
5
6
library(RSSthemes)
ggplot(data = plot_df,
       mapping = aes(x = x, y = y, fill = x)) +
  geom_col() +
  scale_fill_rss_d(palette = "signif_qual") +
  theme_significance()


Before (left) and after (right) styling with {RSSthemes}

As of March 2024, the guide has been viewed by over 14,000 users, in 152 countries.


Data visualisation challenges

Although I primarily use R for data visualisation, I also have experience of using Python, Tableau, rawgraphs, Inkscape, and Figma.

#TidyTuesday

#TidyTuesday is a weekly data challenge aimed at the R community. Every week a new dataset is posted alongside a chart or article related to that dataset, and ask participants explore the data. You can access the data and find out more here.

Below is a selection of my contributions to the #TidyTuesday challenge. All contributions and the code used to generate them can be found on GitHub. You can also browse through all contributions using this dashboard.

#30DayChartChallenge

The #30DayChartChallenge is a data visualisation challenge organised by Cédric Scherer and Dominic Royé. Participants make one chart each day of the challenge, inspired by the daily prompt. The prompts are also split across 5 different categories. Check out the challenge at twitter.com/30DayChartChall. I used a range of tools to create my charts, including R, Python, Tableau, rawgraphs, Inkscape, and Figma.

#30DayMapChallenge

The #30DayMapChallenge is a data visualisation challenge organised by Topi Tjukanov. Participants make one map each day of the challenge, inspired by the daily prompt. Check out the challenge on GitHub, or see contributions on the official website.

Other challenges

Viz For Social Good (VFSG) volunteers create informative and impactful data visualizations for mission-driven organizations across the globe. Check out the organisation here.


Best practices for data visualisation.
A. Krause, N. Rennie. B. Tarran. Royal Statistical Society (online). 2023. Link: royal-statistical-society.github.io/datavisguide.

Analysing and visualising bike sharing demand with outliers.
N. Rennie, C. Cleophas, A. M. Syksulski, F. Dost. Discover Data. Volume 1, Issue 1. March 2023. doi: doi.org/10.1007/s44248-023-00001-z