How to create Calendar Heat Maps in Tableau
Calendar heat map is a variation of a traditional heat map where data is laid-out on Calendar (typically Month on column and weekdays on row, every data point being a date) and colour encoding is depicted using metric of interest which varies by day. It is an alternate visualization to analyse time-series data.
Google defines it as “A calendar chart is a visualization used to show activity over the course of a long span of time, such as months or years. They’re best used when you want to illustrate how some quantity varies depending on the day of the week, or how it trends over time.”
As per my analysis (I could be wrong here and I will appreciate if anyone can correct me here), the calendar heat-map was first used by the winners of JSM Data Expo 2009. The first place went to Rick Wicklin and Robert Allison of SAS Institute and one can find their work here.
Here is a sample screenshot of the work published in the winning entry’s paper
The goal of this visualization which captured twenty years of data (120 MN observations) on commercial domestic flights in USA was to summarize data by time periods and to infer whether is there any correlation between delays in flight and seasonal factors, weather factors or daily factors.
One can refer to the paper for more details and to explore the other visualizations and inferences thereof. After looking at this visualization question came to my mind whether it is possible to create calendar heat-maps in Tableau and the answer was yes. Though Calendar heat map is not readily available chart in Tableau but with minimal efforts, one can achieve the near-perfect calendar heat-map. Let us look at the steps involved in creating calendar heat-map in Tableau. I will be using Tableau Desktop 9.0 Public version for creating this visualization.
The difficult part of creating any visualization is data. One should be able to find the data of interest which one understands and has questions about. For creating calendar heat-map we need data which varies by day. I had a lot of options to choose from; one data set being Sample Superstore Subset (located in \Documents\My Tableau Repository\Datasources) that comes with Tableau installation, second being financial data (closing price of any financial instrument, Index or stock) and third being any data which I really wanted to analyse and answer questions that I have.
I went with third option. I wanted to analyse my broadband internet usage since very long. The questions that I wanted to answer were
a. What is my average monthly, weekly and daily internet usage?
b. How does uploaded volume compare against downloaded volume on monthly, weekly and daily basis?
c. What is my usage pattern with respect to day of the week?
d. What is my usage pattern with respect to hour of the day? And many more
Thankfully my ISP provides data in csv format (well-structured which doesn’t require any cleansing) but the only drawback is at any point in time it provides data for last three months only. So I downloaded the data for Mar to May 2015 and began the analysis. Here is the sneak-peek into the data elements.
Session Start Time with date
Session End Time with date
Data Exploration and Analysis
I will list down the steps that I performed on internet usage data to create Calendar heat-map.
Here is how I connected to data.
Go to Worksheet. Put Start Time on both row and column shelf one by one. On column, shelf drill down at Day level but change it to show Week Number as shown in the screenshot below. Remove Year and Quarter information from the column shelf.
Similarly on row shelf drill down at Day level but change it to show Weekday as shown in the screenshot below. Remove Month and Quarter information from the row shelf.
I am more interested in download volume than upload volume so I put download volume on Colour shelf. I edit the colours to make it vary in the step of 5 for the data value range as shown below.
I rotated the week number label in column shelf as shown below and shrunk the size of the columns.
One can go for increasing the divider level on row and column as shown below by formatting borders. This creates our calendar heat map!!
We will go one step further and to create a time heat map by choosing to show Hour instead of Weekday as shown below.
To answer my some of the questions I created a simple dashboard encompassing time heat map and calendar heat map we just created as shown below.
Clearly there is a correlation between the weekday and internet usage. Internet usage is high on Saturday and Sunday as compared to rest of the days which is correct as I am at home on weekends and do lot of surfing.
Internet usage is high during 7 am and 8 am in the morning as compared to rest of the hours in a day which is again right as I start my day catching up with news and some articles that I have subscribed to and I end up watching useful educational videos. That ends today’s topic of calendar heat map.
Stay tuned for more learning and visualization with Tableau.
Tableau (NYSE: DATA) headquartered in Seattle, Washington has a mission to help people see and understand data. It offers a product portfolio for data visualization focused on business intelligence.
One can visit the official Tableau website to find more details about Tableau and its product offering and features.
Related links you will like:
creating word cloud in Tableau
cricket data visualization with Tableau