Create animated data visualizations in Tableau in just 5 minutes

Contents

Overview

  • Animated visualizations are a work of art and are really easy to create in Tableau.
  • Here we will work with open source datasets and create our own animated visualization in Tableau.

Introduction

I'm a big fan of animated displays. I love the way the data points dance on my screen, interwoven and crossing lines to tell their own stories. Designing an animated visualization is a work of art.

I often use animated displays to show the progress of a cricket match., or the number of points in basketball, or the evolution of the passing game in football (Yes, I am a person crazy about sports). There is a beauty in seeing how the points communicate with each other as they progress in my Tableau worksheet.

Créame, once you start creating these animated visualizations in Picture, there is no way back. You'll be hooked like me, trying to find some excuse to turn the visualization into its animated form.

viz-in-tableau-7824754

I've received numerous requests from our community members and students in my Tableau course on how to create animated visualizations.. So I decided to write this article for all of you. It's a simple premise: we will use open source data and try to create Iconic display of Hans Rosling.

Then, a sample of the animated visualization that we will create in Tableau is shown:

New to Tableau? I highly recommend these resources to get started:

Table of Contents

  • Why should you use animated visualizations?
  • Understanding the problem statement
  • Configure data for animated visualizations in Tableau
  • Create our own animated visualization in Tableau
  • How can we improve this animated display?

Why should you use animated visualizations?

This is a key question: when we have a large number of options at our fingertips to create visualizations, Why should we go for the animated? Are they useful in the industry?

Motion graphics are a hit in the data visualization community due to their aesthetically pleasing nature.. Who doesn't love looking at a dynamic chart showing how trends have changed over time?

tableau_animated_example-8174559

Source: Picture

But aside from its obvious eye-pleasing nature, animated display can be really effective in the industry, either in finance, marketing or sports. I love Tableau's explanation of creating motion charts:

"No animation, changing something like a date filter causes the scatterplot marks to suddenly jump to new locations. It is difficult to pin down what changed or why, but a smooth animation connects the dots. Changes are easier to detect and understand, like when a specific brand becomes an outlier, when there is a sudden rise or fall in value, or when data groups appear. You can feel the bars grow, shrink or rearrange each other, or trace the route of an individual brand.

Animations clarify analysis by drawing attention to what matters and directing your audience's focus to what counts. They help you and others understand What Y why behind the evolving data “.

In summary, carefully designed animated visualizations can improve our understanding of the data.

Understanding the problem statement

We will use open source data sets to create our animated visualizations in Tableau. That is the best way to learn for a wider audience. Can collect data sets (link below) and start working on them right away. Or you can follow me as we go through this tutorial.

Here, our goal is to create an animated visualization that shows the relationship between life expectancy and per capita income of countries over time. This is quite an intriguing project and close to my heart. The idea is to analyze whether these two characteristics are related and how the different countries compare in terms of life expectancy and per capita income..

As I said, this is inspired by Hans Rosling's magnificent visualization and we will use the same data as your organization, gapless, has obtained open source for the community.

We will work with four data sets mainly:

  • life_hope_years: Contains data on life expectancy by country.
  • income_per_person_gdppercapita_ppp_inflation_adjusted: Gross domestic product per person (adjusted for differences in purchasing power)
  • total population: Total population by country
  • countries_total: Contains country names, region names (continents), country codes and other information

All data sets contain annual information from 1800 till the date. You might see some null values. Can you guess why that's the case? This is because some countries were created sometime after 1800. Therefore, there will be blank values ​​in certain columns for them.

You can download all the datasets from the excellent Gapminder site here. Edit: I noticed some people can't find the country dataset. You can download it here – countries_total.

Configure data for animated visualizations in Tableau

Very well, it's time to start Tableau. Here, we will import all of our datasets into Tableau and do some preprocessing steps before we start creating our animated visualization.

Let's start with the life expectancy dataset (the import steps will be similar, if not the same, for the other data sets).

First, import this Excel file into Tableau using the 'Connect' option’ on the Tableau home page. You should see this screen appear:

tableau_animated_1-4922353

There are many values! And our header is displayed in the first row. Let's fix that by right clicking on the life_expectancy_years button and selecting 'Field names are in the first row':

animated_visualization_tableau-4817136

Excellent, that fixed it. Then, I want to accumulate the values ​​in a single column to make it easier for me to analyze the data and create my animated visualization. We will use the help of the option ‘pivot’ from Tableau for this. Just select all columns (except the first), right click on the column header and select 'Pivot':

animated_visualization_tableau_2-9558457

Note: The option 'Pivot’ will only appear if you are importing Excel files (.xlsx). You will not get this option for any other file formats. You will need to use Tableau Prep to convert it to Pivot first and then import it to your Tableau Desktop or public version.

Then, let's change the column names to reflect what they represent. Just right click on the column header and select 'Rename':

animated_visualization_tableau_life-4969324

You can follow the same steps for the other three data sets. Don't forget to rename the columns because we will use one of them as the primary key to connect the four data sets (O, as Tableau says, combine the data). This is what the other datasets should look like after you've done the steps above:

income_per_person_gdppercapita_ppp_inflation_adjusted:

gdp_per_capita_tableau-2919856

total population:

animated_visualization_tableau_population_1-2143376

Let the data set ‘countries_total’ stay as is. You will notice that the headers are already correct and we don't need to pivot anything here. This is what the dataset will look like when we import it into Tableau:

countries_total-8644294

Our data is now ready and ready to create visualizations.

Create our own animated visualization in Tableau

Go to 'Sheet 1’ now and rename it to “Life expectancy versus GDP per capita”. It is very important to name your sheets according to your work. When we work with several sheets (and that happens quite often in the industry), it is important that the names are well defined so that we can easily find the visualization we are looking for.

We can see the four data sets that we have imported in the upper left of our Tableau worksheet. Before starting to use any variable, we need to establish the relationship between the four data sets so that Tableau knows that they are interconnected.

To do this, click on the 'Data' button’ at the top of the Tableau window and select 'Edit Join Relationships':

animated_visualization_blend-300x159-8491839

Then, drag and drop the ‘Life expectancy function (years)’ on your shelf of rows and the ‘GDP per capita’ in its columns:

scatter_plot_tableau-4433460

Then, we must perform three quick actions of drag and drop. Take the dimension ‘Population’ and place it on the button ‘Size’ in the 'Brands' section. Take the 'region’ and place it in the ‘Color cart’ and enter ‘Country’ in the 'Details' cart. This is how your display should look:

animated_tableau-8364254

Our visualization is starting to take shape!! But we have a problem here: axes values ​​are everywhere. They are absurdly tall for both the X axis and the Y axis. Let's fix that before we do anything else.

I will set the life expectancy between 20 Y 90. Right-click the Y axis and select “Edit axis”. Click on the 'Fixed' option’ and enter the values:

life_fix_tableau-8132099

Do the same with the GDP per capita that we will set between $ 200 Y $ 60 000 (and we will choose the logarithmic option). Now we will get a blank worksheet. Where in the world did our data points disappear??

Do not worry, We will get them back soon!

Unleash animations in Tableau!

Time to see the magic unfold. We will use the shelf ‘Pages’ to animate our visualization in Tableau. This Pages shelf helps us divide our visualization into a series of pages, so the animation is created. Each page is a unique view and is based on a member of the field that we place on the Pages shelf.

Pages are especially popular when we want to show the movement of points over time. And that is exactly what we intend to do here. We want life expectancy and GDP per capita to move as the years go by.

So drag and drop your 'Years' function’ on the Pages shelf and select 'Add all members':

table_pages-8847636

And we get our data points back!! You will also notice that a slider has appeared on the right side: that's your shelf of Pages doing its magic. Then, drag the Pages menu from the right side and drop it under the Pages on the left shelf:

table_pages_1-6149418

The size of these bubbles is too small at this time. We can easily increase this by clicking on the 'Size' button.’ under the section ‘Brands’ and increasing the size. What's more, change the display to 'Circle’ in case you have selected 'Form':

animated_tableau_size_shape-5581529

Beautiful! Let's also include the names of the countries in the visualization. Drag and drop the measure ‘Country’ in your ‘Labels’ cart:

animated_tableau_country_labels-4892238

Looking good. All we have to do is watch the animation in action. Very easy: just hit the 'Play button’ in the Pages section and watch the magic unfold:

And there's your own animated visualization in Tableau!!

How can we improve this animated display?

We can do a lot to improve this visualization. to get started, we can do a more granular analysis. We can take some countries, like india, China, United Kingdom, EE. UU., Brazil, etc. and see how life expectancy has progressed against GDP per capita over the years.

Or we can go region by region: analyze how each continent has fared in its own right. There are so many details that we can extract from this animated visualization!!

Outside of this data set, I encourage you to play with different options in Tableau:

  • Try different graphics: see how a line chart changes in Tableau when we make it animated
  • A really cool visualization would be to use animations to see how a map is displayed. changes over time (you can use the Tableau Superstore dataset for this)
  • Pick any previous project you have done and enhance it using what you have learned here
  • Try this in control panels. Imagine the power of an animated board when presented to an audience!!

Honestly, the sky's the limit when it comes to customizing and playing with animations. Go ahead and experience everything you want.

Final notes

I had so much fun putting this together for our community. Animated visualizations can be such a powerful tool if used in the right way and for the right audience.. We have the power to influence our audience by carefully crafting and designing our charts in Tableau.

Did you find this article useful? I would love to hear your thoughts, feedback and experience using this tutorial.

Subscribe to our Newsletter

We will not send you SPAM mail. We hate it as much as you.