Plotting Using ggplot’s Heat Map

Jesse F
2 min readDec 8, 2018

--

Throughout one of my coures I got the opportunity of working with programming language R. I have learned that packages like ggplot allow me represent data in visual graph. I really liked making graphs and looking at any patterns or visually looking for anything interesting in the graph. But there are many more plotting options that ggplot allows. One of these options are a heat map. Heat maps allow us to represent data visually with very appealing colors. By looking at the color differences we could make key and quick observations. See image below to see for how a heat map looks like.

Heat map of mortality rates from Heatmaps of Mortality Rates article.

In the article Heatmaps of Mortality Rates published in R bloggers website, mentions how a heat map could be used to produce a graph that displays mortality rates using R programming language and using packages like ggplot. In the article, data about mortality rates in England and Whales was used. The data can be plotted over time, creating a graph where the x-axis would be year and the y-axis would be the mortality rates. By using a heat map we would get an outcome of a graph where the graph is colored by filling areas of the graph from the raster of the data. By looking at the outcome and comparing two graphs, like gender, we would be able to see big differences. In the article, it was observed that war greatly affected male mortality while influenza had more effect on female mortality.

The article relates to the course work because the course has used ggplot to plot data. I think I could use the material presented in the article to answer questions relating a topic over time. One example would be relating time and income. I could use data from the US Census, and filter income and year. I could then use a heat map to plot income over any years I would like. Lets say I wanted to plot the years from 1990 to 2018. I could use a heat map, and I would most likely see an income drop somewhere between 2007 and 2009, this is where the US had a recession. I could then look at a specific area in the US, lets say Seattle, and look at how the recession impacted Seattle and compare that the overall US. Heat maps could be used to explore many topics over time; plotting birth rate over time, prices of specific foods over time, population density over time, etc. This article has opened another opportunity for me to explore plotting data, and I could use this knowledge to further improve my analysis and get a better understanding of data.

--

--