Heatmaps

Heatmaps are a simple but effective way to interpret numeric datasets. They work best when the data to be charted (in a heatmap) has been either aggregated or is of a limited size (rows and columns) so that they can be viewed effectively.

R has a native inbuilt heatmap charting feature. It can be invoked using the R function, heatmap.

Alternatively, there are other R packages for creating impressive heatmaps. One such example is shown as follows. The parameters have been referenced from the site package at https://rlbarter.github.io/superheat/:

devtools::install_github("rlbarter/superheat") 
 
row.names(Hartnagel) <- Hartnagel$year 
 
superheat(Hartnagel[,-1],heat.pal = c("#b35806", "white", "#542788"),heat.na.col = "white", yr = Hartnagel$mconvict, ...

Get Hands-On Data Science with R now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.