Share with your network!

Step wise tableau tutorial: Animation with Page Shelf in Tableau

The blog is a humble effort to recreate the visual story shown by Hans Rosling in his memorable and highly popular 2006 TED talk . One of my friends urged me to view this talk and after seeing this video my interest towards data and visualization shot up. If anyone wants to master the art of story-telling with visualization than this video is a must watch. One can see the original visualization created by Hans Rosling and his team here.

Data

In this blog we are going to recreate the same visualization (as shown in the video/talk) to analyse how Life Expectancy in years (health) and GDP per capita (wealth) have changed over time in the world for various countries.

One can find the relevant data here or here (look for source data spread sheet icon in the visualization on the axis). We need following data for this exercise

  • Life Expectancy in years
  • Income per person (GDP/capita, PPP$ inflation-adjusted)
  • Population, Total
  • Regions of the World

Data Exploration and Analysis

Step 1 – Connect to GDP/Capita data

Open the Data worksheet from Excel file that has data for Income per person i.e. GDP/capita.

connecting excel to tableau

Tableau ’s data interpreter has detected potential issues with the structure of the data. First row actually represents the year as data in the file is arranged as cross-tab of Countries (Rows) against Years (Columns). Let us turn on the data interpreter.

data  interpreter in tableau

Tableau Data interpreter rightly detected the first row as data headers and made the changes accordingly. In the process it also merged the row for country “Abkhazia” into header as it had null values for all the years. We will not worry about Abkhazia’s data loss as it never had data for any of the years (1800 to 2013). One can review the changes done by Tableau’s data interpreter. It generates a summary of changes with legends in the separate Excel workbook with original data.

Let us rename the first column and proceed ahead.

renaming column  in tableau

We will use Tableau’s pivot feature to convert the cross tab data into tabular format as shown below.

Select all the columns from 1800 to 2013 and right click à Pivot

pivot feature in  tableau

Rename the columns to Year and GDP per Capita as shown below.

renaming columns in tableau

Step 2 – Connect to Life Expectancy data source

While connecting indicate to Tableau that the first row has field names in it.

connecting data source in  tableau

Convert the cross tab into tabular format and rename the fields similar to what we did in step 1.

connecting data in tableau

Step 3 – Connect to Population, Total data source

While connecting indicate to Tableau that the first row has field names in it.

connecting data in tableau

Convert the cross tab into tabular format and rename the fields similar to what we did in step 1.

connecting data in tableau

Step 4 – Connect to Country to Region mapping data source

connecting data in tableau

Step 5 – Go to Sheet 1

You should 4 data sources that we have connected to from step 1 to step 4 as shown below.

data visualisation in  tableau

Step 6 – Put GDP per Capita on Column Shelf

data visualisation in  tableau

Step 7 – Put Life Expectancy on Row Shelf

data visualisation in  tableau

Since we are using a different data source, Tableau expects us to define the relationship between the two data sources.

Establish Country and Year as link between the two data sources as shown below.

Go to Data à Edit Relationships

defining  relationship in tableau

Tableau automatically detected relationship between primary and secondary data sources by matching column names. Review the relationship for all secondary data sources and click ok.

defining  relationship in tableau

Step 8 – Put Country on Details Shelf to create Scatter plot

steps for adding animation  in tableau

Step 9 – Put Total Population on Size Shelf

steps for adding animation  in tableau

Step 10 – Put Region on Colour Shelf

steps for adding animation  in tableau

Step 11 – Put Year (from Primary data source) on Pages Shelf

steps for adding animation  in tableau

Step 12 – Format axis

Change the range for Life Expectancy axis as shown below.

steps for adding animation  in tableau

Convert GDP Per Capita axis to logarithmic Scale set the range as shown below.

steps for adding animation  in tableau

Step 13 – Change the Size of the bubbles

steps for adding animation  in tableau

We have successfully created the visualization. Now adjust the Page Shelf settings such as speed, whether to show history, trail etc. as per your preferences and see the animation. One can convert this work into Dashboard for publishing purpose and for more options.

Below is the outcome (animated gif) of the steps performed above.

steps for adding animation  in tableau

Stay tuned for more learning through visualization with Tableau.

About Tableau
Tableau (NYSEDATA) 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.