Monday 14 May 2012

Brushing Heatmaps

I picked up a fun visualization from Matt Styles on called "How common is your birthday"?

Some of the commentary - especially from Andy Kirk - made me think a bit about how we use heatmaps.  So, I fired up QlikView, grabbed the data from The New York Times, and opened up a link to Color Brewer.

The map in question shows us the rank of each of the days of the year as regards number of births - rather than the actual numbers.  Here is my representation using a QlikView pivot chart:

The code for the color is:

ColorMix1(Rank/366, RGB(0,68,27), White())

I believe that there is a fundamental flaw representing this number of points (obviously 366) in a heat map where the value is the rank versus the actual value.  The flaw is that the difference in color does not give us the difference in magnitude between the different blocks.

With this number of blocks, I can see that there is an obvious pattern of darker colors in July-September, but I find it very difficult to pick out, among the sea of darker colors, the ones that represent the actual top ranked days.

Feeling that this might be something that people might want to do, I thought about how I might do it in QlikView and came up with this variant:

Here, I am using a second color range to represent the top 10 (all in September) and the bottom 10 (with February 29th obviously being the lowest).

Essentially, I this is an example of brushing but applied to a heatmap.

The code for the mixed block is:

if(Rank <= 10, ColorMix1(Rank/20, RGB(12,15,124), White()),
if(Rank > 356, ColorMix1((367-Rank)/20, RGB(179,0,0), White()),
ColorMix1(Rank/366, RGB(0,68,27), White())))

It would be a fairly straightforward matter to give the user an interactive facility to turn on/off the Top 10 or Bottom 10.

Stephen Redmond is CTO of CapricornVentis a QlikView Elite Partner

No comments:

Post a Comment

Note: only a member of this blog may post a comment.