Data Visualization: Top 10 Countries by Life Expectancy

Visualize top 10 countries by life expectancy in Tableau using an area chart, filtering by sum to handle missing data, and labeling countries for clarity.

Learn how to refine your Tableau visualizations by applying filters, adjusting chart types, and improving data clarity. This article demonstrates how to transform an overcrowded life expectancy dataset into a more digestible and insightful graphic display.

Key Insights

  • Enhancing Tableau visualizations involves moving dimensions like "Country Name" to the Detail shelf and adjusting chart types—such as switching to area charts—to better represent complex datasets with missing values.
  • Applying a Top N filter, such as displaying only the top 10 countries by life expectancy, helps simplify large datasets and makes the visualization more relevant and readable.
  • Noble Desktop demonstrates how using the Sum instead of Average can resolve issues with missing data and how formatting elements like labels and fonts can improve overall chart readability.

Note: These materials offer prospective students a preview of how our classes are structured. Students enrolled in this course will receive access to the full set of materials, including video lectures, project-based assignments, and instructor feedback.

Now, this is something I can show you to really make it look like, I'm just gonna undo to make sure I haven't selected any of those designs. So to make it look like the visualization, you'll take a country name, which is, these are all the countries as one, and what you'll do is you'll move it over to detail. When you move it to detail, it shows you the individual detail for this line.

Right now, it's not showing you individual detail. So I'll take country name and I'll drag it to detail. And then now it does that.

If I wanna change the color to make it look sort of grayish, I can do that just like it was in the visualization. I'll go over here and choose entire view. And now if I move my mouse, I get that little pop-up that tells me each of the countries and the life expectancy.

And for all of the years, it changes if I go across or go to the right. If I go back to the PowerPoint, oops, I'm gonna go here. Yeah, sort of like that.

All right, so how about a better version of this? Now, I know we didn't spend too much time going over this, but there is a way that you can come up with a better visualization. This is what I would recommend. And this is me just playing around.

Tableau Bootcamp: Live & Hands-on, In NYC or Online, Learn From Experts, Free Retake, Small Class Sizes,  1-on-1 Bonus Training. Named a Top Bootcamp by Forbes, Fortune, & Time Out. Noble Desktop. Learn More.

I found this by accident because there's a couple of things that you can do. There's another sheet where you can actually bring in the regions and you can create a connection between the original data table and the regions and then do a filter by region. You'd still see too many lines.

This is what I would recommend for this chart. Other recommendations have been to show the information based on decades, because it's just too many years. And so if you do decades in certain countries, but maybe the kind of report that someone's watched from this is the top 10 countries based on life expectancy.

So that would be a perfect filter. So what I'm gonna do is I'm gonna take country name and I'm gonna drag it over to filters. And then I wanna apply condition.

The condition for countries is by the field life expectancy. Actually, no, I don't want a condition, sorry. Top, that's what I just mentioned before.

I want the top 10 countries by life expectancy. So I'm gonna choose field and here's a top 10. And I'll just leave it at this for now.

I know I could do a better calculation. Ideally, what you wanna do is choose average. Average would be a better calculation.

There's a problem with average because there's a couple of countries that are missing information. They're gonna appear very small. I'll show you what it looks like just so you can see what I'm talking about.

So I'll do top 10 and I'll click apply. I'll click okay. And then you say, well, that's not much better.

Now, show me is can actually help you with this. I'll head over to show me and then I'll choose the area chart. This is the one that works best for me.

I click area and there we go. Now, this is the problem I said with the lines. There are certain countries that don't have information for all the years.

So they show up like this. I'm gonna go over to country name. I'm gonna choose edit filter and I'm gonna change this back to sum.

Everything will sum and I will have one value. I won't have to worry about trying to get an average where there's missing data. Sum works better in this situation.

I'll click okay. Now, everything is filled in. So you say, oh, great.

These are the top 10 countries, but where are the countries? Now it would be appropriate to take country name and move that to label. So I'll take country name and move it over into label. Oh, and there we go.

I might wanna increase the size of the country names so you could see it a little bit better. I'll go to font and then I'll change this to something like 14 and say, should I make it bold? Yep, there we go. And so now I have a nice colorful display of the top 10 countries in relation to life expectancy.

It's gonna be a little different from what I had in Excel. As you can see, this is what I had in Excel, but this is based on the average. There may be some overlap.

Norway is there. Switzerland is there as well. But this is a quick example of something you could do with Tableau.

It's a little bit better than what we saw in the original visualization, which looked like this. So the goal of this is not necessarily to make a perfect chart, but to look at the data interpreter and see how it can help us clean up information. We don't have to save this.

I'm gonna save this book because now we're gonna move on to another topic. We're not gonna use the same information. I'm gonna choose file, save as, and I'm gonna call this life expectancy or my life expectancy.

The area graph isn't the best type for this purpose. Yeah, visually it's great, but it's not the best chart for this purpose. Any of the other charts that I've tried don't work as well.

This looks a little bit better, but this also can be a little too much. Okay, so here's the line chart. We do get the years, the actual ages, and so you get the lines here.

Things are not a little spread out, but I like the area chart, but yeah. So this is a work in progress, so it's not perfect, but that's the challenge. I like this one, let's see.

No, that gives me too much information. I thought it was just gonna show me the 10. Yep, a little bit better, but these are really all close together.

All right, so I'm gonna close this. Yes, I'm gonna save changes.

Garfield Stinvil

Garfield is an experienced software trainer with over 16 years of real-world professional experience. He started as a data analyst with a Wall Street real estate investment company & continued working in the professional development department at New York Road Runners Organization before working at Noble Desktop. He enjoys bringing humor to whatever he teaches and loves conveying ideas in novel ways that help others learn more efficiently.

Since starting his professional training career in 2016, he has worked with several corporate clients including Adobe, HBO, Amazon, Yelp, Mitsubishi, WeWork, Michael Kors, Christian Dior, and Hermès. 

Outside of work, his hobbies include rescuing & archiving at-risk artistic online media using his database management skills.

More articles by Garfield Stinvil

How to Learn Tableau

Master Tableau with Hands-on Training. One of the World’s Most Popular Data Visualization Tools, Tableau Allows Users to Create Graphs, Charts, and Other Illustrations to Share Their Analytical Findings.

Yelp Facebook LinkedIn YouTube Twitter Instagram