Join us
Orange welcome sign that reads Royal Geographical Society with IBG.

Become a member and discover where geography can take you.

Join us

Roger Beecham, Lecturer in Geographic Data Science at the University of Leeds, created a visualisation showing shifting voting patterns in the 2019 general election. Here Roger explains why he created the visualisation, the methods he used and why he chose to present it in this way.

Map showing voting patterns in the 2019 general election
© Roger Beecham


What story does this visualisation tell?

A big story from the Conservative Party victory in the UK 2019 General Election was not simply the size of the party’s win, but its geography. Constituencies forming Labour’s ‘red wall’ in the north of England elected Conservative candidates for the first time, a pattern that was repeated in constituencies in Wales and the Midlands.

The visualisation attempts to capture this shifting pattern of Conservative-Labour voting in the UK by displaying the Butler Two-party Swing (Butler and Van Beek, 1990) in vote share at the constituency-level. It does so by borrowing design ideas from a Washington Post article by Lazio Gamio and Dan Keating entitled ‘How Trump redrew the electoral map’ (Gamio and Keating, 2016).

The visualisation is published as a Featured Graphic in Environment & Planning A and was primarily intended for other geographers. However, due to its timeliness, visual design and the use of symbolisation being reasonably intuitive, it could be of interest to a wider public audience too.

What data, methods and tools did you use to create it and why?


I mainly used General Election results data, primarily vote counts by political party from the 2017 and 2019 General Elections, aggregated at the UK Parliamentary Constituency level.

Two-party Swing was calculated directly from these two datasets. Swing represents the average change in share of the vote won by two parties contesting successive elections. In this case, this means mostly adding the rise in the Conservative’s vote share and fall in Labour’s vote share between 2017 and 2019 and dividing by two. The measure needs some interpretation though — Churchill apparently re-arranged fruit on his desk to help understand the measure! A swing to the Conservatives from Labour could manifest in three ways:

  • an increase in Conservative vote share and a decrease in Labour vote share.

  • an increase in both Conservative and Labour vote share, but with the Conservative increase outstripping that of Labour’s.

  • a decrease in both Conservative and Labour vote share, but with the Conservative decline being less severe than that of Labour's.

Data describing UK-wide deprivation at the small area level was also collected via a dataset published by Abel et al. (2016) and following Alasdair Rae’s excellent recent analysis of constituency-level deprivation and voting (Rae, 2019).

Methods — visual encoding

In the main graphic, each constituency is represented as a line positioned at constituencies' geographic centres. The lines are then oriented continuously according to the Two-party Swing measure:

  • Lines positioned vertically show a swing of 0% — either there is no shift in Labour-Conservative vote share at that constituency, or Labour and the Conservatives are gaining or losing votes from/to other parties in equal measure.

  • Lines oriented to the right show a swing to the Conservatives.

  • Lines oriented to the left show a swing to Labour.

It is possible for a constituency to swing heavily to Conservative or Labour without that party winning, and so lines are additionally coloured according to the winning party (Conservative, Labour, Other). This encoding is also used when filling polygons representing constituencies.

In order to expose the ‘realignment’ of Conservative constituencies, the lines have been made bold where the winning party for a constituency represents a change in allegiance from 2017. To further emphasise the diversification of the Conservative party base, presented in the legend is a list of constituencies flipping to Conservative arranged by region. A bar chart also shows counts of Conservative constituencies by deprivation decile that differentiates Conservative gains from more ‘typical’ hold constituencies, and annotated on the map are constituencies that defy conventional wisdom in electing a Conservative candidate for the first time (or for the first time in 80+ years).

Why did you choose to present it this way over other approaches?

The inspiration for the visualisation came from Lazio Gamio and Dan Keating's excellent work for the Washington Post (Gamio and Keating, 2016), but also the various articles appearing both pre- and post- the election (probably starting from the 2016 Brexit vote) pronouncing a ‘realignment’ in UK politics (e.g. Sabbagh, 2019). Traditional political party affiliations linked to class and identity were dissolving and the political geography of the country was becoming increasingly distinctive.

In terms of the visualisation design, the problems of representing voting outcomes using standard Choropleth maps are well-discussed, with cartograms now used widely in much press reporting. However, in distorting space, cartograms do introduce problems if the aim is to locate and recognise constituencies and regions. Since the main indicator (swing) was represented by single lines of regular size, and since the regional geography of shifting voting behaviour seemed important, it felt appropriate to use "real" (physical) geographies instead of a cartogram (though the map could equally work on a hex cartogram).

At first glance, the graphic might read like a standard choropleth map of voting outcomes - constituencies are coloured according to winning party, for example. However, in making the lines representing swing the most visually striking marks on the graphic, as well as those constituencies switching allegiance from 2017, on second glance the 'realignment' story starts to emerge. Looking closer still, we start to see more regional patterns of Conservative swings - lines oriented largely to the right in the North East, Wales, Yorkshire and the Humber and North West. Even for constituencies that did not flip to the Conservatives, the bold blue lines surrounded by red lines are also oriented to the right. Of the small number of constituencies (34) swinging for Labour (oriented left), 18 are located in London or the South East and six in Scotland.

What impact or engagement would you like the visualisation to have?

The visualisation was created using a high-level declarative visualisation library (ggplot2) and so is reasonably light in terms of code. These sorts of high-level frameworks (others include vega-lite, and bindings such as Altair and elm-vega) are beginning to democratise visualisation design as they require little prior coding experience. I've tried to make the data graphic reproducible (via a github repository) and hope that spatial analysts working in academia and industry might feel inspired and start to think about how they can use these sorts of techniques and approaches in their work.

Secondarily, for those with a general interest in UK politics and/or cartographic design, the visualisation might be illuminating. Or at least might demonstrate some of the patterns that have been previously discussed in political autopsies written immediately after the 2019 General Election.

How else might this approach or data be used or extended?

The idea behind ggplot2 (and vega-lite) is that visualisation design is concerned with the mapping of data to visuals. You, as an analyst, think about the data available and how that data might be encoded through visual channels (Munzner, 2014). ggplot2 and vega-lite provide a framework for specifying this mapping.

In the accompanying github repository, I was also interested in studying how voting behaviour varies between urban-rural constituencies - and therefore quickly updated the ggplot2 specification such that each constituency is represented as a triangle, coloured according to winning party and sized according to population density.

There are many examples of visualisations using angle to represent variation over space (as in the main graphic), for example to study change in crime over space or physical phenomena such as variation in wind direction.


Try it yourself

Roger carried out all the analysis and visualisation design in R, with graphics generated using the ggplot2 package. Further discussion and code describing how the layouts were produced can be found at this github repository.


About the creator

Roger Beecham is a Lecturer in Geographic Data Science at the University of Leeds. Roger’s research demonstrates how new, passively-collected datasets can be repurposed for social science research, including spatial data analysis, information visualisation, transport planning, political geography and crime science. 

You can find out more about Roger on his website.