\(~~~~~~~~\)Lab: Data Visualization\(~~~~~~~~\)

Somsak Chanaim

International College of Digital Innovation, CMU

July 2, 2025

What’s in the Gapminder Dataset?

This dataset provides economic and health indicators for countries around the world from the year 1952 to 2007. The data comes from the Gapminder Foundation, an organization that develops educational tools for understanding global development and sustainability.

Variables in Gapminder

The dataset contains 6 key variables:

  1. country: Name of the country (e.g., Afghanistan, Brazil, China)

  2. continent: Continent where the country is located (Africa, Americas, Asia, Europe, Oceania)

  3. year: Year the data was recorded (1952, 1957, …, 2007)

  4. lifeExp: Life Expectancy: the

average number of years a person is expected to live in each country

  1. pop: Population: total number of people living in the country

  2. gdpPercap: GDP per Capita: Gross Domestic Product divided by population (in US dollars)

Effective Visual Communication for Quantitative Scientists

Example of Gapminer Data

Download Gapminder Dataset

You can download the Gapminder dataset from Google Drive: Click here to download

Why use Gapminder?

The Gapminder dataset has a rich and structured format, making it ideal for:

  • Creating visualizations in Excel

  • Analyzing global development trends

  • Comparing data across countries, continents, and time

1. Line Chart: Life Expectancy Trend

Use Case: Visualizing the trend of life expectancy (lifeExp) for a specific country over time.

Goal: Show the trend of life expectancy in Thailand from 1952 to 2007.

Step-by-Step Instructions

  1. Filter the data for Thailand

  2. Select two columns:

    • year (X-axis)

    • lifeExp (Y-axis)

  3. Go to Insert → choose Line Chart

  4. Choose chart type: Line with Markers is recommended

  5. Adjust axis labels:

    • X-axis = Year

    • Y-axis = Life Expectancy

Output Example

A smooth line chart showing how Thailand’s life expectancy has increased from 1952 to 2007.

2. Bar Chart: GDP per Capita Comparison

Use Case: Compare GDP per capita (gdpPercap) among countries in a specific year.

Goal: Compare GDP per capita of countries in Asia for the year 2007.

Step-by-Step Instructions

  1. Filter the data for:

    • continent == "Asia"

    • year == 2007

  2. Select two columns:

    • country (X-axis)

    • gdpPercap (Y-axis)

  3. Go to Insert → choose Bar Chart

  4. Choose the chart type: Clustered Bar or Clustered Column

  5. Adjust the axis:

    • X-axis = Country

    • Y-axis = GDP per Capita

  6. (Optional) Sort GDP values from highest to lowest for better communication.

Output Example

A bar chart that shows the economic disparity among Asian countries in 2007, highlighting countries with high or low GDP per capita.

3. Pie Chart: Population Proportion

Use Case: Visualize the population share (pop) of countries within a specific continent and year.

Goal: Show the population proportions of countries in Africa in the year [2007.

Step-by-Step Instructions

  1. Filter the data for:

    • continent == "Africa"

    • year == 2007

  2. Select two columns:

    • country (as categories)

    • pop (as values)

  3. Go to Insert → choose Pie Chart

  4. Choose a chart type: 2D Pie or 3D Pie

  5. Add Data Labels: Show either percentage or actual population

Output Example

A pie chart showing the distribution of population among African countries in 2007, giving a clear view of how population is concentrated.

4. Scatter Plot: GDP vs Life Expectancy

Use Case: Explore the relationship between GDP per capita and Life Expectancy.

Goal: Visualize the relationship between GDP per capita and Life Expectancy

for all countries in the year [2007.

Step-by-Step Instructions

  1. Filter the data for: year == 2007

  2. Select two columns:

    • gdpPercap (X-axis)

    • lifeExp (Y-axis)

  3. Go to Insert → choose Scatter Chart

  4. Choose a chart type:

    • Scatter with Markers

    • (Optional) Scatter with Smooth Lines

  5. Adjust axis labels:

    • X-axis = GDP per Capita

    • Y-axis = Life Expectancy

💡 Tip: Sort your data by gdpPercap or lifeExp (ascending or descending) before plotting for clearer insights and cleaner visuals.

Output Example

The chart shows how countries with higher GDP per capita often have longer life expectancy — a sign of better health outcomes.

5. Area Chart: Population Trend

Use Case: Show the trend of population (pop) over time for a specific continent.

Goal: Visualize the population growth in Europe from [1952 to 2007.

Step-by-Step Instructions

  1. Filter the data for: continent == "Europe"

  2. Summarize population by year: Use a PivotTable to sum pop for all countries in each year

  3. Go to Insert → choose Area Chart (found under the Line Chart options)

  4. Choose chart type:

    • Stacked Area

    • or 100% Stacked Area (for proportion comparison)

Output Example

An area chart that shows how the population of Europe has changed over time,
emphasizing both magnitude and growth trend.

💡 Tip

  • Use Stacked Area when comparing parts of a whole (e.g., population by region)

  • Use Standard Area when focusing on total growth over time.

6. Stacked Bar Chart: Population Comparison by Country and Year

Use Case: Compare population (pop) across countries in the same continent, separated by year.

Goal: Compare the population of countries in Americas between the years 1952 and [2007.

Step-by-Step Instructions

  1. Use a PivotTable and Slicer to filter:

    • continent == "Americas"

    • Years 1952 and 2007

  2. Select data:

    • country as categories

    • pop for both years

  3. Go to Insert → choose Stacked Bar Chart

  4. Choose chart type:

    • Clustered Column (grouped bars for each year)

    • or Stacked Column (stacked segments for each year)

Output Example

A grouped or stacked bar chart comparing how populations have changed in countries across the Americas from 1952 to 2007.

💡 Tip: Use Clustered Column for side-by-side year comparison, and Stacked Column for visualizing the contribution of each country to the total population.

7. Bubble Chart: GDP, Life Expectancy & Population

Use Case: Visualize the relationship between [GDP per capita, [Life Expectancy, and Population size using a Bubble Chart.

Goal: Show the relationship between GDP per capita and Life Expectancy in 2007,

with bubble size representing the population.

Step-by-Step Instructions

  1. Filter the data for:

    • year == 2007
  2. Select three columns:

    • gdpPercap → X-axis

    • lifeExp → Y-axis

    • pop → Bubble size

  3. Go to Insert → choose Bubble Chart

  4. Set bubble size to represent population (pop)

  5. (Optional) Add country labels or tooltips for clarity

Output Example

A bubble chart showing:

  • Countries with high GDP and high life expectancy in the upper-right

  • Bubble sizes indicating how population varies among them

💡 Tip: Sort or filter out countries with extremely high populations if bubbles overlap too much. You may also normalize bubble sizes for better visualization.

8. Heatmap: Life Expectancy by Country and Year

Use Case: Highlight trends and variations in values (e.g., life expectancy) using color gradients.

Goal: Create a heatmap showing Life Expectancy (lifeExp) of each country in Asia

from 1952 to 2007 using Conditional Formatting in Excel.

Step-by-Step Instructions

  1. Filter the data for: continent == "Asia"

  2. Use a PivotTable:

    • Rows = country

    • Columns = year

    • Values = average of lifeExp

  3. Select the PivotTable cells with numeric values

  4. Go to Home Conditional Formatting → choose Color Scales

  5. Pick a color scale (e.g., green-yellow-red) to indicate value differences

Output Example

A color-coded table where:

  • Green = Higher life expectancy

  • Red = Lower life expectancy

  • Clear visual patterns over time across countries

💡 Tip: Use a diverging color scale to emphasize differences and make comparisons easier.
This approach works well for time-series or multivariate country data.

Output Example

A chart with multiple lines showing:

  • How life expectancy changed over time

  • Differences and similarities between Asian countries

💡 Tip: Use consistent colors or label key countries directly on the lines to enhance readability and avoid clutter.