Creating a Heatmap

 

A heatmap is basically a table that has colors in place of numbers. Colors correspond to the level of the measurement. Each column can be a different metric like above, or it can be all the same like this one. It’s useful for finding highs and lows and sometimes, patterns.

From Nathan Yau | Visualize This

In order to visualize trends within large sets of data, it is useful consider to create a data heat map with color instead of number allowing display highs and lows.

If it true that the accuracy is lost for the lack of the numbers, but a wide vision about trends is obtained in exchange.

The colors used within the table, belong a spectrum of colors based on its distance from the statistical mean, so, in that way, intuitively darker colors means one thing and lighter colors another thing facilitating a quick evaluation about patterns, maximum and minimum values.

Intro

As I read the book “Visualize This” from Nathan Yau, I was analyzing which projects could implement the ideas presented. And one of the graphics that came back to my mind again and again was the Heatmap.

Code

library(RColorBrewer)

america <- read.csv("AmericaCupData.csv", sep=",")
america <- america[order(america$Title, decreasing = FALSE),]

row.names(america) <- america$Team
america <- america[,2:17]
america_matrix <- data.matrix(america_titles)

america_heatmap <- heatmap(america_matrix, Rowv=NA, 
Colv=NA, col = brewer.pal(9, "Blues"), scale="column", 
margins=c(5,10))

Result

copaamerica

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: