Graphing mortality II
On bar graphs, showing a value using a line can be effective.
3 min readApr 15, 2021
Last week, I looked at how to emulate the mortality graph with a ranged ribbon. This week, I seek to emulate a graph in the Office for National Statistics weekly death reports.
The graph has the following key elements:
- A stacked bar graph, showing deaths which involve and do not involve COVID-19. A death ‘involves’ a disease if clinicians believe it caused or contributed to the death.
- A straight line representing the weekly average of deaths in 2015 to 2019.
- A legend showing what all three counts correspond to on the graph.
- Informative text and arrows, highlighting public holidays influence death registrations in particular weeks.
Setting up
First, we start by install packages that we need:
library(tidyverse)
library(readxl)
library(scales)
library(lubridate)
I had some trouble installing the ‘ungeviz’ package in R Studio Cloud. I was able to find Prof Wilke’s code for the geom_hpline
function. We can use that instead. We draw the values from a prepared file (which I added a date to):
ons_deathregistration_figure3_df <- read_excel("ONS Weekly…