Heat-Maps in R

How do we make heat-maps in R?

Anthony B. Masters
The Startup

--

Heat-maps show individual values as colours in two dimensions. Whilst the term is modern, the idea of colouring cells to show values has done for over a century.

This article looks at how to create a heat-map in R.

Hot, hot, hot

A cluster heat-map has tiles: the positions refer to two different categories. In that structure, analysts display the value through colour. One way to show lab-confirmed cases of the SARS-CoV-2 virus is through a heat-map.

An example is from Dr Robertson (Loughborough University):

(Image: Twitter/Dr Duncan Robertson)

Here, the horizontal position refers to the week, and the vertical position is the age group. Dr Robertson uses a colour scale to show lab-confirmed cases per 100,000 estimated people. Public Health England publish these figures, for pillar 1 and 2 testing in England.

This virus spreads through contact and through the air. An infected person being close to other people means a risk of passing the virus on.

A pre-print paper by Dr Adam Kurcharski (LSHTM), Dr Hannah Fry (UCL) and others looked at social contacts. As part of the BBC’s Pandemic study, people downloaded an app. That app recorded approximate locations every hour for 24 hours.

--

--

Anthony B. Masters
The Startup

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