Recreating a Dumbbell Graph in R

How have moral attitudes changed in the past thirty years?

Anthony B. Masters
Nov 16, 2019 · 3 min read

Ipsos MORI conducted two surveys, around 30 years apart, asking people what they believe is immoral. This article looks at how to recreate the dumbbell graph used in their article in R.

Between two surveys

In March 1989, the social research company Ipsos MORI asked 1,458 adults in face-to-face interviews:

Here is a list of issues some people might think are immoral or morally wrong. Which of them, if any, do you personally think are morally wrong?

Various items were listed. In partnership with the Policy Institute at King’s College London, Ipsos MORI conducted a second study in June to July 2019, talking to 1,021 adults (aged 15 or over). Their article showed a dumbbell graph created in Datawrapper:

Some items given in the graph are shortened from what was said to respondents, such as:

The use of hard drugs such as heroin

Changes in the survey structure — such as using different characteristics to “reflect the GB population profile” — are unlikely to explain these large differences between the two surveys.

Recreating the graph

In the ggalt package in R, there is the ‘geom_dumbbell’ tool. Additionally, we need to replicate the various labels. A similar article looked at recreating a graph produced by Pew Research Center.

The ‘tidy’ version of the data-set should remain in its tabular form, because the two observations (1989 and 2019) are needed separately (for ‘x’ and ‘xend’). A sign function is used later, to make the labels face the right way:

The colours used are to match the Ipsos MORI report. The crux is the graph is the following code:

After that, we put the two labels representing the years, above the first line. The first label is given here:

Labelling the title, subtitle and caption comes next. We put labels for each year next to the issues, such as this label for 1989:

The final graph then looks like:

More work could be done to exactly match the original graph, such as changing the font and text sizes from this ‘clean’ theme. This is a good visualisation, as a bar graph with 20 sets would be unwieldy look at.

The full code may be read at R Pubs, and the Excel data file is available to download from Google Sheets.

The Startup

Medium's largest active publication, followed by +773K people. Follow to join our community.

Anthony B. Masters

Written by

This blog looks at the use of statistics in Britain and beyond. It is written by RSS Statistical Ambassador and Chartered Statistician @anthonybmasters.

The Startup

Medium's largest active publication, followed by +773K people. Follow to join our community.

Anthony B. Masters

Written by

This blog looks at the use of statistics in Britain and beyond. It is written by RSS Statistical Ambassador and Chartered Statistician @anthonybmasters.

The Startup

Medium's largest active publication, followed by +773K people. Follow to join our community.

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store