24
$\begingroup$

Question: When (for what types of data visualization problems) are heat maps most effective? (In particular, more effective than all other possible visualization techniques?)

When are heat maps least effective?

Are there any common patterns or rules of thumb one can use to decide whether or not a heat map is likely to be an effective way of visualizing the data, and when they are likely to be ineffective?

(Principally I have in mind heat maps for 2 categorical variables and 1 continuous variable, but am also interested in hearing about opinions regarding other types of heat maps.)

Context: I am taking an online course about data visualization, and right now they are discussing ineffective and over-used plot types. They already mentioned dynamite plots and pie charts, and the reasons given for why those are ineffective and why there are better alternatives to them were clear and convincing to me. Moreover, it was easy to find other sources corroborating the given opinions about dynamite plots and pie charts.

However, the course also said that "heat maps are one of the least effective types of data visualization". A paraphrasing of the reasons why are given below. But when I tried to find other places on Google corroborating this view point, I had a lot of difficulty, in contrast to looking up opinions about the effectiveness of pie charts and dynamite plots. So I would like to know to what extent the characterization of heat maps given in the course is valid, and when the factors against them are least important and most important for a given context.

The reasons given were:

  1. It is difficult to map color onto a continuous scale.

    There are some exceptions to this rule, so this is not usually a deal breaker, but in the case of heat maps, the problem is particularly difficult, because our perception of a color changes depending upon the neighboring colors. Thus heat maps are not well-suited for seeing individual results, even in small data sets. Which leads to:

  2. Answering specific questions using a table look-up method is generally not feasible, since it is impossible to infer with sufficient accuracy the numerical value corresponding to a given color.

  3. Often the data are not clustered in such a way to bring out trends.

    Without such clustering it is often difficult or impossible to infer anything about general overall patterns.

  4. Heat maps are often only used to communicate a "wow factor" or just to look cool, especially when using a multicolor gradient, but there are usually better ways to communicate the data.

Plotting continuous data on a common scale is always the best option. If there is a time component, the most obvious choice is a line plot.

$\endgroup$
17
  • 16
    $\begingroup$ The criticism of "heat maps" comes down to the last line of (4): exactly what are these "better ways" to communicate? (If there are no better ways, then (1)-(3) are scarcely relevant.) If the purpose literally is to communicate the data, then obviously there are better ways: write down the numbers. The purpose of a visualization, though, is rarely to communicate the data: instead, it is to support an interpretation or send a message. What interpretations does your source have in mind and what does it claim are the better ways to present those interpretations? $\endgroup$
    – whuber
    Commented May 28, 2017 at 19:57
  • 4
    $\begingroup$ @whuber As a supplement for that - one very nice thing about heat maps is that in many cases it's easy to supplement them by displaying the raw data (perhaps appropriate rounded) directly on each tile. Even using conditional formatting for the background colour of cells on a spreadsheet is a very effective, and very common, "heat map" of sorts, in which context it is hard to see how they can be improved upon. $\endgroup$
    – Silverfish
    Commented May 28, 2017 at 21:14
  • 2
    $\begingroup$ My comment pertains only to critique 1. It is correct that color (hue) does not map to an ordered scale psychologically although it does physically (wave length). However, by adding a redundant dimension such as brightness can make them more easily interpreted. You could have dark higher than light but use colors such as light blue and dark red. $\endgroup$
    – David Lane
    Commented May 28, 2017 at 21:40
  • 2
    $\begingroup$ Depends on the context. Here's a great example of valuable, actionable information gained from a heat map, for which I can think of no other more convenient or useful data visualization type. $\endgroup$
    – Jason C
    Commented May 28, 2017 at 22:25
  • 5
    $\begingroup$ The color is superfluous (and, admittedly, poorly chosen--it's just the default image colormap in R), but here is an example about Minesweeper play that I worked up several years ago. I found the heatmap immediately illuminating in that it reveals structure about the problem that becomes intuitively clear once you see it and think about it for a moment, but which is not immediately obvious (to most people) prior to seeing the plot. $\endgroup$
    – cardinal
    Commented May 28, 2017 at 22:30

7 Answers 7

18
$\begingroup$

There is no such thing as a "best" plot for this or for that. How you plot your data depends on the message you want to convey. Commonly used plots have the advantage that users are more likely to be able to read them. Nevertheless, that does not mean that they are necessarily the best choice.

Regarding heat maps, I've ordered my response by the supposed arguments against them.

1) If you don't trust color as an encoding channel, use brightness instead, with a scale encompassing dark gray to light gray "color" tones. Most often, you want to bin continuous variables (also see 5), so you can keep the number of colors low and make it easier to decode by users. This is not a must though. Take a look at this example, in which the continuous variable is not binned.

2) Certainly, they should not be used as an alternative to look up precise values. Heat maps should primarily be used to illustrate patterns, not to replace tables.

3,4) I don't see how this would be related to heat maps only.

5) Heat maps are ideally but not necessarily used with discrete variables. For continuous variables, heat maps can be used as a sort of two-dimensional histogram or bar chart, with proper binning, as well as brightness as an encoding channel.

$\endgroup$
4
  • 2
    $\begingroup$ Awesome answer! Except I don't know what "Ad" means. Latin? Abbreviation? $\endgroup$
    – xan
    Commented May 28, 2017 at 23:23
  • 1
    $\begingroup$ Thanks! "ad" means "on" or "concerning", I guess it comes from Latin. $\endgroup$
    – g3o2
    Commented May 28, 2017 at 23:39
  • $\begingroup$ I've never seen "ad" used that way either (cc, @xan). From your description, I think I might use pace. $\endgroup$ Commented May 29, 2017 at 2:40
  • 3
    $\begingroup$ @gung Not really, IMO. It has no connotations, unlike pace - it just means in addition, addendum, in reference to, as for... Not to mention it was universal in the West, coming from Latin and used extensively in theology and scientific and political literature, among other things. In a (mail) dialog, the two parties would use it to reference the arguments to each of the points. It seems to be falling into disfavour as written language gets trimmed, though. The usual replacement is just using "1.1" instead of "Ad 1.1", which can be a bit confusing and seems a bit rude to me, but oh well. $\endgroup$
    – Luaan
    Commented May 29, 2017 at 13:52
5
$\begingroup$

Someone can not say Heat Map is the least effective type of visualization. I would rather say it depends on your requirement. In some cases Heat maps are very useful. Let's say you have to make a report on crime in a country state-wise (or city-wise). Here you will have a huge data set which can have time dependencies.

Similarly, let's say you have to prepare a report on electricity consumption for cities. In these cases you can easily visualize through Heat map. It will make more sense and be less cumbersome.

So, in a nutshell, if you have lots of continuous data and you want to make a report which can pin-point the answers quickly then Heat map is best.

$\endgroup$
3
  • 3
    $\begingroup$ For energy consumption, there often is no better plot than a heatmap : argustech.be/wp-content/uploads/2012/04/heatmap.png Week-ends and work hours jump right at the viewer. You can see the base load, you can see peaks, you can see when they happen. You can detect any weird pattern in a few seconds, for example if some electrical device is always on or starts too early or too late. $\endgroup$ Commented May 29, 2017 at 9:17
  • $\begingroup$ @EricDuminil letting you know that your link seems to be broken! $\endgroup$
    – Amelian
    Commented Jun 28, 2023 at 20:23
  • 1
    $\begingroup$ @Amelian: Thanks! Wayback machine to the rescue! web.archive.org/web/20160508090343/http://argustech.be/… $\endgroup$ Commented Jun 29, 2023 at 7:16
4
$\begingroup$

As aforementioned by others, it is really improper to say that heat maps are always ineffective. Actually, they are quite effective in many instances.

For example, if you want to visualize 4D data, it is simple enough to do the first three dimensions in many plotting software. However, the whole concept of 4D is pretty difficult to conceptualize at all. What is the "4th" direction/dimension?

That's where a heat map may be effective, because it will allow to plot the first three dimensions on coordinate axis, and the fourth can be visualized by stacking a heat map onto your plotted plane (or line, but that's less likely).

Bottom line is that you need context. What are you looking for in your visualization? Also, as a fellow self-teacher, I can tell you that these online courses tend to be very trivial and unhelpful. You are much better off only using them when you are looking for information/help on specific topics rather than looking to be taught about a whole subject.

Best of luck anyway though.

$\endgroup$
4
$\begingroup$

Critique 1 in the original question covers the biggest drawback - that it is difficult for someone reading the heat map to decode the quantitative information that is conveyed. Consider an xy-scatter plot or dot plot, where the underlying quantity is directly related to the distance on the chart - very straightforward for interpretation.

In a heat map, on the other hand, the person reading the chart is at liberty to interpret 10% 'redder' or 'darker' to their own satisfaction. On top of that is the problem of differing abilities of people to discern colour and shade to begin with. These are genuine disadvantages, but they are not universally fatal.

The third critique, by contrast, seems to inadvertently identify an occasion when heat maps are especially useful - when the data is clustered on a 2D plane so that similar values in a third dimension show as patches of a particular shade or colour. So while heat maps are ineffective at some things, they are useful for others, and they should stay in your bag, in the same way that golfers often carry pitching wedges or similar despite their being useless for driving or putting, or carpenters don't disregard hammers because they are no good for cutting wood.

In general visualising data should be seen as iterative activity that will take some time as you try a number of visualisations that bring out the important features of the data, including trying more than one kind of visualisation, and then experimenting to find the best settings within particular choices. Nor should it be assumed that the result will be one visualisation - sometimes a number of visualisations of data will needed to highlight multiple important features of the data. In this context, there will be times where for particular features of particular data sets, the heat map will be the most effective, and communicating clusters as described may be one of those times. Overall, there will be frequent occasions where a single visualisation cannot do everything, and more than one will be required.

$\endgroup$
3
$\begingroup$

By nature, a heat map displays data with two continuous independent variables (or, not quite equivalently, one independent variable from a two-dimensional vector space), and one continuous dependent variable. For data of that type, a heat map is definitely one of the most effective types of data visualisation. Yes, it has its problems, but that's inevitable: you really have only two dimensions to work with and a three-dimensional space cannot be mapped to that in a structure-preserving way, therefore you need a hack like mapping one dimension to colour or drawing contour lines etc..

If the independent variables are categorical, the heat map immediately makes much less sense: there's generally no reason why a categorical variable would map onto a real axis. In fact a categorical variable, by definition, does not come with any pre-determined topology, or we might say, with the discrete topology. Now unlike $\mathbb{R}^2$, which is only homeomorphic to another two-dimensional space, the cartesian product $X\times Y$ of two discrete spaces is actually homeomorphic to any space of the cardinality $|X| \cdot |Y|$, which is finite for a categorical variable – in other words, the cartesian product of two categorical variable can be considered as a single categorical variable! And in that light, you can just as well use other plots, which don't have the problems of a heat map.

If you find yourself in a situation where a heat map over two categorical variables appears useful, it's an indication that these are probably not really categorical variables, but rather quantised continuous variables.

$\endgroup$
3
  • 5
    $\begingroup$ This answer is interesting, but I think gives short shrift to the notion of using heatmaps with categorical variables. For example, one might rank categorical levels by their counts (or some other relevant sorting variable) and then use a heatmap to visualize the joint distribution or some other quantity that varies with the joint categorical levels. This can be tied to copulas (and generalized notions thereof). Such visualizations, when done well, can reveal real structure in the data which would otherwise be very difficult to detect. (...) $\endgroup$
    – cardinal
    Commented May 28, 2017 at 22:14
  • $\begingroup$ (...) And, such an approach is independent of any (direct) notion of embedding the categorical levels into a Euclidean space. $\endgroup$
    – cardinal
    Commented May 28, 2017 at 22:17
  • $\begingroup$ I was wondering if you have any comment on the practice of using heat maps for gene expression/microarray data then -- these would seem like cases of using heat maps for 2 categorical and one continuous variable for which the categorical variables can't really be interpreted as quantized continuous variables. Or I guess heat maps for correlation matrices of categorical variables in general. $\endgroup$ Commented May 30, 2017 at 7:08
3
$\begingroup$

Heat maps are great at providing a simplistic view of multiple variables from a time series perspective- the data can be absolute changes over time or standardized using Z scores or other means to examine variables with different measurements intervals or relative changes of subgroups. It does provide a very visually noticeable view that one can spot correlations- or inverses and replaces a multitude of graphs. They can also be used in preprocessing to assess possible dimensionality reduction- i.e. Factoring or PCA.

The bad- intervening variables and other factors can become hidden and passed by when using this approach to spot correlations. The same hidden aspects do occur with line graphs- however given the large number of variables- my experience is that heat maps brings so much information that a user does not consider the intervening aspects nor other hidden factors.

This from a a data scientist from a progressive economist perspective with 20 years in the field producing data and tasked at educating the general public with such data.

$\endgroup$
1
$\begingroup$

Heatmaps are advantageous over scatterplots when there are too many data points to view on a scatterplot. This can be mitigated in a scatterplot using translucent data points but beyond a certain threshold it becomes better to summarize the data.

In this blog post a compelling example of scatterplots being hard to interpret is given.

A scatterplot can only visually represent density up to a certain threshold - the threshold of "points everywhere"...

Plot density, not points

The solution is to plot the binned point density rather than the points themselves. We already know this method in one dimension as the histogram.

In two dimensions, there are multiple ways of doing it. The bin shapes can be taken from any method of uniformly tiling the plane, such as squares or hexagons. For each tile, the number of data points inside the tile are counted. The tile is then assigned a color according to the number of points.

A similar statement from the ggplot2 docs on heatmap of 2d bin counts:

This is a useful alternative to geom_point() in the presence of overplotting.

In the docs of geom_point():

Overplotting

The biggest potential problem with a scatterplot is overplotting: whenever you have more than a few points, points may be plotted on top of one another. This can severely distort the visual appearance of the plot. There is no one solution to this problem, but there are some techniques that can help. You can add additional information with geom_smooth(), geom_quantile() or geom_density_2d(). If you have few unique x values, geom_boxplot() may also be useful.

Alternatively, you can summarise the number of points at each location and display that in some way, using geom_count(), geom_hex(), or geom_density2d().

Another technique is to make the points transparent (e.g. geom_point(alpha = 0.05)) or very small (e.g. geom_point(shape = ".")).

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.