Wednesday, June 18, 2014

Using Treemaps and Heatmaps to visualize data

Recently I tried exploring the functionality and use of Treemaps in helping me manage my list of campaigns. I used R in Excel and hard coded the data into the template diagram, after running a MySQL script to extract the data from my company's database. What I found is that while it helps me visualize which campaigns are under-performing, what I really needed is a BI tool that would allow me to bucket certain campaigns by geographic split/account managers/size of campaigns etc.

The limitation of what I had tried was that it allowed me only 2 variables - I chose performance to be color coded into a scale of 100% (red) to 0% (black) to 100% (green) and the revenue spend over the campaign's lifetime as the size of each rectangle, in an attempt to understand the big picture of my campaigns per account manager to see which campaign I should look at and optimize right away. All in all, I think a tool like this would be useful for campaign analysts, and it would probably take a few software engineers around 6-8 months to build out a BI tool with this functionality. In the meantime, writing a macro with integration to the MySQL database would temporarily give us this functionality - with a lot of query tweaking for different sets of data.

Performance Treemap across a region

Performance Treemap subset

These were the links I found particularly useful when creating Treemaps using R:


For Heatmaps, i find it only particularly useful in the context of showing distribution of a particular variable (in this case - Gas Prices) on an actual geographic map.

In the context of analytics in online advertising, it is commonplace to generate insights for the client that includes a map of the world or targeted locality (e.g. by country - US) and have heat spots on a varying color scale showing states or dmas with varying levels of performance (e.g. clicks/conversions or their respective click/conversion lifts).


Other common uses of Heatmaps would be to visualize values or a data set in tabular format but I don't find this extremely useful as of now. If I were to utilize this, it would most likely be a supplementary diagram since the functionality of this visualization is rather limited.

You can easily create something like that below in excel using conditional formatting on the entire table of values. For help creating this diagram, please visit this link: