1 Introduction

This document presents a comprehensive visualization study of global development trends from 1952 to 2007 using the Gapminder dataset. The analysis demonstrates both foundational ggplot2 techniques and advanced visualization methods using extension packages.

1.1 Objectives

  • Explore relationships between GDP per capita, life expectancy, and population
  • Visualize continental differences in development trajectories
  • Demonstrate advanced visualization techniques including animations and interactivity
  • Create publication-ready figures suitable for academic or professional contexts

1.2 Data Source

The Gapminder dataset contains longitudinal data on 142 countries across five continents, tracking:

  • Life expectancy at birth (years)
  • GDP per capita (inflation-adjusted US dollars)
  • Population

Data spans from 1952 to 2007 in 5-year intervals.


2 Environment Setup

2.1 Required Packages

# Core packages
library(tidyverse)
library(gapminder)

# Advanced ggplot2 extensions
library(gganimate)
library(ggridges)
library(ggforce)
library(ggbeeswarm)
library(patchwork)
library(gghighlight)
library(ggrepel)
library(ggtext)

# Interactive visualization
library(ggiraph)
library(plotly)
library(htmlwidgets)

# Color and themes
library(viridis)
library(RColorBrewer)
library(ggthemes)
library(scales)

2.2 Global Theme and Color Palette

# Set global theme
theme_set(theme_minimal(base_size = 12))

# Custom color palette for continents
continent_colors <- c(
  "Africa" = "#E41A1C",
  "Americas" = "#377EB8", 
  "Asia" = "#4DAF4A",
  "Europe" = "#984EA3",
  "Oceania" = "#FF7F00"
)

3 Data Exploration

3.1 Dataset Overview

data("gapminder")
glimpse(gapminder)
## Rows: 1,704
## Columns: 6
## $ country   <fct> "Afghanistan", "Afghanistan", "Afghanistan", "Afghanistan", …
## $ continent <fct> Asia, Asia, Asia, Asia, Asia, Asia, Asia, Asia, Asia, Asia, …
## $ year      <int> 1952, 1957, 1962, 1967, 1972, 1977, 1982, 1987, 1992, 1997, …
## $ lifeExp   <dbl> 28.801, 30.332, 31.997, 34.020, 36.088, 38.438, 39.854, 40.8…
## $ pop       <int> 8425333, 9240934, 10267083, 11537966, 13079460, 14880372, 12…
## $ gdpPercap <dbl> 779.4453, 820.8530, 853.1007, 836.1971, 739.9811, 786.1134, …

3.2 Summary Statistics by Continent

gapminder %>%
  group_by(continent) %>%
  summarise(
    `Countries` = n_distinct(country),
    `Avg. Life Expectancy` = round(mean(lifeExp), 1),
    `Avg. GDP per Capita` = scales::dollar(mean(gdpPercap)),
    `Total Population (M)` = round(sum(as.numeric(pop)) / 1e6, 1)
  ) %>%
  knitr::kable(
    caption = "Summary Statistics by Continent (1952-2007)",
    align = c("l", "r", "r", "r", "r")
  )
Summary Statistics by Continent (1952-2007)
continent Countries Avg. Life Expectancy Avg. GDP per Capita Total Population (M)
Africa 52 48.9 $2,193.75 6187.6
Americas 25 64.7 $7,136.11 7351.4
Asia 33 60.1 $7,902.15 30507.3
Europe 30 71.9 $14,469.48 6181.1
Oceania 2 74.3 $18,621.61 213.0

3.3 Derived Datasets

# 2007 snapshot for cross-sectional analysis
gapminder_2007 <- gapminder %>% 
  filter(year == 2007)

# Aggregated summary by continent and year
gapminder_summary <- gapminder %>%
  group_by(continent, year) %>%
  summarise(
    avg_lifeExp = weighted.mean(lifeExp, pop),
    avg_gdpPercap = weighted.mean(gdpPercap, pop),
    total_pop = sum(as.numeric(pop)),
    n_countries = n_distinct(country),
    .groups = "drop"
  )

4 Basic Visualizations

This section reviews foundational ggplot2 techniques covered in standard R visualization courses.

4.1 Scatter Plot with Log Scale

The classic GDP vs. life expectancy relationship, with population represented by bubble size.

ggplot(gapminder_2007, aes(x = gdpPercap, y = lifeExp)) +
  geom_point(aes(size = pop, color = continent), alpha = 0.7) +
  scale_x_log10(labels = dollar_format()) +
  scale_size_continuous(
    range = c(2, 15), 
    labels = label_number(scale = 1e-6, suffix = "M"),
    name = "Population"
  ) +
  scale_color_manual(values = continent_colors, name = "Continent") +
  labs(
    title = "Life Expectancy vs GDP per Capita (2007)",
    subtitle = "Bubble size represents population",
    x = "GDP per Capita (log scale, USD)",
    y = "Life Expectancy (years)",
    caption = "Source: Gapminder"
  ) +
  theme_minimal(base_size = 14) +
  theme(
    legend.position = "right",
    plot.title = element_text(face = "bold", size = 16),
    plot.subtitle = element_text(color = "gray40")
  )
Life Expectancy vs GDP per Capita (2007)

Life Expectancy vs GDP per Capita (2007)

4.2 Labeled Scatter Plot

Highlighting major countries for contextual understanding.

notable_countries <- c("China", "India", "United States", "Japan", "Nigeria",
                       "Brazil", "Germany", "South Africa", "Bangladesh", "Indonesia")

ggplot(gapminder_2007, aes(x = gdpPercap, y = lifeExp)) +
  geom_point(aes(size = pop, color = continent), alpha = 0.6) +
  geom_text_repel(
    data = gapminder_2007 %>% filter(country %in% notable_countries),
    aes(label = country),
    size = 3.5,
    box.padding = 0.5,
    point.padding = 0.3,
    segment.color = "gray50",
    max.overlaps = 20
  ) +
  scale_x_log10(labels = dollar_format()) +
  scale_size_continuous(range = c(2, 15), guide = "none") +
  scale_color_manual(values = continent_colors) +
  labs(
    title = "Global Development Landscape (2007)",
    subtitle = "Major countries labeled by population size",
    x = "GDP per Capita (log scale)",
    y = "Life Expectancy (years)"
  ) +
  theme_minimal(base_size = 12)
Global Development Landscape with Country Labels

Global Development Landscape with Country Labels

4.3 Faceted Comparison by Continent

ggplot(gapminder, aes(x = gdpPercap, y = lifeExp)) +
  geom_point(aes(size = pop, color = year), alpha = 0.5) +
  geom_smooth(method = "lm", se = FALSE, color = "red", linewidth = 0.8) +
  facet_wrap(~continent, scales = "free_x") +
  scale_x_log10(labels = dollar_format()) +
  scale_size_continuous(range = c(1, 10), guide = "none") +
  scale_color_viridis_c(name = "Year") +
  labs(
    title = "Development Trajectories by Continent (1952-2007)",
    subtitle = "Each point is a country-year observation; red line shows linear trend",
    x = "GDP per Capita (log scale)",
    y = "Life Expectancy"
  ) +
  theme_minimal() +
  theme(strip.text = element_text(face = "bold", size = 12))
Development Trajectories by Continent

Development Trajectories by Continent

4.5 Distribution Visualizations

Multiple perspectives on the distribution of life expectancy in 2007.

# Histogram
p5a_hist <- ggplot(gapminder_2007, aes(x = lifeExp, fill = continent)) +
  geom_histogram(bins = 25, alpha = 0.7, color = "white") +
  scale_fill_manual(values = continent_colors) +
  labs(title = "Histogram", x = "Life Expectancy", y = "Count") +
  theme_minimal() +
  theme(legend.position = "none")

# Density plot
p5b_density <- ggplot(gapminder_2007, aes(x = lifeExp, fill = continent)) +
  geom_density(alpha = 0.5) +
  scale_fill_manual(values = continent_colors) +
  labs(title = "Density Plot", x = "Life Expectancy", y = "Density") +
  theme_minimal() +
  theme(legend.position = "none")

# Box plot
p5c_box <- ggplot(gapminder_2007, aes(x = continent, y = lifeExp, fill = continent)) +
  geom_boxplot(alpha = 0.7) +
  scale_fill_manual(values = continent_colors) +
  labs(title = "Box Plot", x = "", y = "Life Expectancy") +
  theme_minimal() +
  theme(legend.position = "none")

# Violin plot
p5d_violin <- ggplot(gapminder_2007, aes(x = continent, y = lifeExp, fill = continent)) +
  geom_violin(alpha = 0.7, draw_quantiles = c(0.25, 0.5, 0.75)) +
  scale_fill_manual(values = continent_colors) +
  labs(title = "Violin Plot", x = "", y = "Life Expectancy") +
  theme_minimal() +
  theme(legend.position = "none")

# Combine using patchwork
(p5a_hist | p5b_density) / (p5c_box | p5d_violin) +
  plot_annotation(
    title = "Multiple Views of Life Expectancy Distribution (2007)",
    theme = theme(plot.title = element_text(size = 18, face = "bold"))
  )
Multiple Views of Life Expectancy Distribution

Multiple Views of Life Expectancy Distribution


5 Advanced Visualizations

This section demonstrates techniques from specialized ggplot2 extension packages that go beyond standard course curricula.

5.1 Ridgeline Plot

The ridgeline (or “joy plot”) shows how the distribution of life expectancy shifted over time, inspired by Joy Division’s album artwork.

ggplot(gapminder, aes(x = lifeExp, y = as.factor(year), fill = stat(x))) +
  geom_density_ridges_gradient(
    scale = 3, 
    rel_min_height = 0.01,
    gradient_lwd = 0.5
  ) +
  scale_fill_viridis_c(name = "Life Exp.", option = "C") +
  scale_y_discrete(expand = c(0.01, 0)) +
  labs(
    title = "Evolution of Global Life Expectancy Distribution",
    subtitle = "Ridgeline plot showing how the distribution shifted over decades",
    x = "Life Expectancy (years)",
    y = "Year"
  ) +
  theme_ridges(font_size = 13, grid = TRUE) +
  theme(
    axis.title.y = element_text(angle = 0, vjust = 0.5),
    legend.position = "right"
  )
Evolution of Global Life Expectancy Distribution

Evolution of Global Life Expectancy Distribution

Key insight: The distribution has shifted rightward over time, with the bimodal pattern (developing vs. developed nations) becoming less pronounced.

5.2 Beeswarm Plot

Unlike jittered points, beeswarm plots show each data point without overlap, preserving the actual distribution shape.

ggplot(gapminder_2007, aes(x = continent, y = lifeExp, color = continent)) +
  geom_beeswarm(size = 3, alpha = 0.7, cex = 2.5) +
  geom_boxplot(alpha = 0.2, outlier.shape = NA, width = 0.3) +
  scale_color_manual(values = continent_colors) +
  labs(
    title = "Life Expectancy Distribution: Beeswarm Visualization",
    subtitle = "Each point represents one country — no overlap, actual data positions",
    x = "",
    y = "Life Expectancy (years)"
  ) +
  theme_minimal(base_size = 14) +
  theme(legend.position = "none")
Life Expectancy Distribution: Beeswarm Visualization

Life Expectancy Distribution: Beeswarm Visualization

5.3 Zoom Facet

The facet_zoom() function from ggforce allows focusing on a specific data region while maintaining the full context.

ggplot(gapminder_2007, aes(x = gdpPercap, y = lifeExp, color = continent)) +
  geom_point(aes(size = pop), alpha = 0.7) +
  scale_size_continuous(range = c(2, 15), guide = "none") +
  scale_color_manual(values = continent_colors) +
  scale_x_log10(labels = dollar_format()) +
  facet_zoom(
    xlim = c(500, 5000),
    ylim = c(35, 65),
    horizontal = FALSE,
    zoom.size = 1
  ) +
  labs(
    title = "GDP vs Life Expectancy with Zoom on Low-Income Countries",
    subtitle = "ggforce facet_zoom() highlights developing nations",
    x = "GDP per Capita (log scale)",
    y = "Life Expectancy"
  ) +
  theme_minimal(base_size = 12)
GDP vs Life Expectancy with Zoom on Low-Income Countries

GDP vs Life Expectancy with Zoom on Low-Income Countries

5.4 Highlighting Specific Data

Using gghighlight to create narrative-driven visualizations that focus on specific stories within the data.

gapminder %>%
  filter(continent == "Asia") %>%
  ggplot(aes(x = year, y = lifeExp, color = country)) +
  geom_line(linewidth = 1) +
  gghighlight(
    country %in% c("China", "Japan", "India", "Cambodia", "Afghanistan"),
    use_direct_label = TRUE,
    label_params = list(size = 4)
  ) +
  scale_x_continuous(breaks = seq(1952, 2007, 10)) +
  labs(
    title = "Asian Countries: Diverse Development Paths",
    subtitle = "Highlighting notable trajectories — from rapid growth to conflict disruption",
    x = "Year",
    y = "Life Expectancy",
    caption = "Note: Cambodia's dip reflects the Khmer Rouge era (1975-1979)"
  ) +
  theme_minimal(base_size = 14) +
  theme(legend.position = "none")
Asian Countries: Diverse Development Paths

Asian Countries: Diverse Development Paths

5.5 Connected Scatter Plot

Showing the trajectory of individual countries through time, with arrows indicating direction.

selected_countries <- c("China", "India", "United States", "Rwanda", "South Korea")

gapminder %>%
  filter(country %in% selected_countries) %>%
  ggplot(aes(x = gdpPercap, y = lifeExp, color = country)) +
  geom_path(linewidth = 1, alpha = 0.8, 
            arrow = arrow(length = unit(0.15, "cm"), type = "closed")) +
  geom_point(aes(size = pop), alpha = 0.6) +
  geom_text_repel(
    data = . %>% filter(year == 2007),
    aes(label = paste(country, year)),
    size = 3,
    nudge_x = 0.1
  ) +
  geom_text_repel(
    data = . %>% filter(year == 1952),
    aes(label = year),
    size = 2.5,
    color = "gray40"
  ) +
  scale_x_log10(labels = dollar_format()) +
  scale_size_continuous(range = c(2, 12), guide = "none") +
  scale_color_brewer(palette = "Set1") +
  labs(
    title = "Development Trajectories: 1952-2007",
    subtitle = "Connected scatter plot showing each country's path through time",
    x = "GDP per Capita (log scale)",
    y = "Life Expectancy",
    color = "Country"
  ) +
  theme_minimal(base_size = 12)
Development Trajectories: 1952-2007

Development Trajectories: 1952-2007

Notable observations:

  • South Korea: Dramatic diagonal rise — both economic and health improvements
  • Rwanda: The 1994 genocide is visible as a sharp drop
  • China & India: Parallel health improvements despite different economic trajectories

5.6 Mark Annotations

Using ggforce to automatically circle and annotate groups of points.

ggplot(gapminder_2007, aes(x = gdpPercap, y = lifeExp)) +
  geom_point(aes(size = pop, color = continent), alpha = 0.6) +
  geom_mark_ellipse(
    aes(fill = continent, label = continent, filter = continent == "Africa"),
    alpha = 0.1,
    show.legend = FALSE,
    label.fontsize = 10,
    con.cap = 0
  ) +
  geom_mark_hull(
    aes(fill = continent, filter = continent == "Europe"),
    alpha = 0.1,
    show.legend = FALSE,
    expand = unit(3, "mm"),
    radius = unit(3, "mm")
  ) +
  scale_x_log10(labels = dollar_format()) +
  scale_size_continuous(range = c(2, 15), guide = "none") +
  scale_color_manual(values = continent_colors) +
  scale_fill_manual(values = continent_colors) +
  labs(
    title = "Regional Clustering with ggforce Annotations",
    subtitle = "Ellipse marks Africa, hull marks Europe — automated region highlighting",
    x = "GDP per Capita",
    y = "Life Expectancy"
  ) +
  theme_minimal(base_size = 12)
Regional Clustering with ggforce Annotations

Regional Clustering with ggforce Annotations

5.7 Heatmap: Country-Year Life Expectancy

top_pop_countries <- gapminder %>%
  filter(year == 2007) %>%
  arrange(desc(pop)) %>%
  head(25) %>%
  pull(country)

gapminder %>%
  filter(country %in% top_pop_countries) %>%
  ggplot(aes(x = year, y = reorder(country, lifeExp), fill = lifeExp)) +
  geom_tile(color = "white", linewidth = 0.5) +
  scale_fill_viridis_c(option = "plasma", name = "Life\nExpectancy") +
  scale_x_continuous(breaks = seq(1952, 2007, 5), expand = c(0, 0)) +
  labs(
    title = "Life Expectancy Heatmap: Top 25 Most Populous Countries",
    subtitle = "Countries ordered by 2007 life expectancy",
    x = "Year",
    y = ""
  ) +
  theme_minimal(base_size = 11) +
  theme(
    axis.text.y = element_text(size = 9),
    panel.grid = element_blank()
  )
Life Expectancy Heatmap: Top 25 Most Populous Countries

Life Expectancy Heatmap: Top 25 Most Populous Countries

5.8 Rich Text Labels

Using ggtext for markdown/HTML formatting in plot labels.

gapminder_summary %>%
  filter(year %in% c(1952, 1977, 2007)) %>%
  ggplot(aes(x = continent, y = avg_lifeExp, fill = as.factor(year))) +
  geom_col(position = "dodge", alpha = 0.8) +
  scale_fill_viridis_d(option = "D", name = "Year") +
  labs(
    title = "<span style='color:#2C3E50'>Global Progress:</span> 
             <span style='color:#E74C3C'>Life Expectancy</span> 
             <span style='color:#2C3E50'>Gains by Continent</span>",
    subtitle = "Comparing **1952**, **1977**, and **2007** averages",
    x = "",
    y = "Average Life Expectancy (years)",
    caption = "*Population-weighted averages*"
  ) +
  theme_minimal(base_size = 14) +
  theme(
    plot.title = element_markdown(size = 16, face = "bold"),
    plot.subtitle = element_markdown(),
    plot.caption = element_markdown(face = "italic"),
    legend.position = "bottom"
  )
Global Progress: Life Expectancy Gains by Continent

Global Progress: Life Expectancy Gains by Continent


6 Animated Visualizations

6.1 Animated Bubble Chart (Hans Rosling Style)

This animation recreates the famous “200 Countries, 200 Years, 4 Minutes” visualization popularized by Hans Rosling.

p_animate <- ggplot(gapminder, aes(x = gdpPercap, y = lifeExp, size = pop, color = continent)) +
  geom_point(alpha = 0.7, show.legend = TRUE) +
  scale_x_log10(labels = dollar_format()) +
  scale_size(range = c(2, 15), guide = "none") +
  scale_color_manual(values = continent_colors, name = "Continent") +
  labs(
    title = "Development Through Time: Year {frame_time}",
    subtitle = "Bubble size = Population | X-axis = GDP per Capita (log) | Y-axis = Life Expectancy",
    x = "GDP per Capita (USD, log scale)",
    y = "Life Expectancy (years)",
    caption = "Data: Gapminder | Inspired by Hans Rosling"
  ) +
  theme_minimal(base_size = 14) +
  theme(
    legend.position = "bottom",
    plot.title = element_text(face = "bold", size = 18),
    plot.subtitle = element_text(color = "gray40")
  ) +
  transition_time(year) +
  ease_aes('linear') +
  shadow_wake(wake_length = 0.1, alpha = FALSE)

# Render animation
animate(p_animate, nframes = 100, fps = 10, width = 900, height = 600,
        renderer = gifski_renderer("animated_bubble.gif"))

Note: Animation rendering is disabled in this document for performance. Run the code chunk manually to generate the GIF.


7 Interactive Visualizations

7.1 Interactive Scatter with ggiraph

Hover over points to see country details; click to highlight.

p_ggiraph <- ggplot(gapminder_2007, 
                    aes(x = gdpPercap, y = lifeExp, color = continent)) +
  geom_point_interactive(
    aes(
      size = pop,
      tooltip = paste0(
        "<b>", country, "</b><br>",
        "Life Expectancy: ", round(lifeExp, 1), " years<br>",
        "GDP per Capita: $", format(round(gdpPercap), big.mark = ","), "<br>",
        "Population: ", format(pop, big.mark = ",")
      ),
      data_id = country
    ),
    alpha = 0.7
  ) +
  scale_x_log10(labels = dollar_format()) +
  scale_size_continuous(range = c(2, 15), guide = "none") +
  scale_color_manual(values = continent_colors) +
  labs(
    title = "Interactive Global Development Map (2007)",
    subtitle = "Hover over points for details",
    x = "GDP per Capita (log scale)",
    y = "Life Expectancy"
  ) +
  theme_minimal(base_size = 12)

girafe(
  ggobj = p_ggiraph,
  width_svg = 10,
  height_svg = 7,
  options = list(
    opts_hover(css = "fill:orange;stroke:black;stroke-width:2px;"),
    opts_selection(css = "fill:red;stroke:black;stroke-width:3px;", type = "multiple"),
    opts_zoom(min = 0.5, max = 4)
  )
)

Interactive Global Development Map (2007)

7.2 Plotly Interactive Visualization

p_plotly_base <- ggplot(gapminder_2007, 
                        aes(x = gdpPercap, y = lifeExp, 
                            color = continent, size = pop,
                            text = paste("Country:", country,
                                        "<br>Continent:", continent,
                                        "<br>Life Exp:", round(lifeExp, 1),
                                        "<br>GDP:", scales::dollar(gdpPercap),
                                        "<br>Pop:", scales::comma(pop)))) +
  geom_point(alpha = 0.7) +
  scale_x_log10(labels = dollar_format()) +
  scale_size_continuous(range = c(3, 15), guide = "none") +
  scale_color_manual(values = continent_colors) +
  labs(
    title = "Global Development (2007)",
    x = "GDP per Capita",
    y = "Life Expectancy"
  ) +
  theme_minimal()

ggplotly(p_plotly_base, tooltip = "text") %>%
  layout(
    hoverlabel = list(bgcolor = "white"),
    legend = list(orientation = "h", y = -0.15)
  )

Global Development (2007) - Plotly Interactive


8 Summary Visualization

8.1 Comprehensive Story Panel

A multi-panel figure bringing together the key insights from this analysis.

# Panel 1: Historical Progress
panel1 <- gapminder_summary %>%
  ggplot(aes(x = year, y = avg_lifeExp, color = continent)) +
  geom_line(linewidth = 1.2) +
  geom_point(size = 2) +
  scale_color_manual(values = continent_colors) +
  labs(subtitle = "A. Life Expectancy Trends",
       x = "Year", y = "Life Exp. (years)") +
  theme_minimal(base_size = 10) +
  theme(legend.position = "none")

# Panel 2: GDP Growth
panel2 <- gapminder_summary %>%
  ggplot(aes(x = year, y = avg_gdpPercap, color = continent)) +
  geom_line(linewidth = 1.2) +
  geom_point(size = 2) +
  scale_color_manual(values = continent_colors) +
  scale_y_continuous(labels = dollar_format()) +
  labs(subtitle = "B. GDP per Capita Growth",
       x = "Year", y = "GDP per Capita") +
  theme_minimal(base_size = 10) +
  theme(legend.position = "none")

# Panel 3: Current Distribution
panel3 <- gapminder_2007 %>%
  ggplot(aes(x = lifeExp, y = reorder(continent, lifeExp), fill = continent)) +
  geom_density_ridges(alpha = 0.7, scale = 1.5) +
  scale_fill_manual(values = continent_colors) +
  labs(subtitle = "C. Life Expectancy Distribution (2007)",
       x = "Life Expectancy", y = "") +
  theme_minimal(base_size = 10) +
  theme(legend.position = "none")

# Panel 4: Relationship
panel4 <- gapminder_2007 %>%
  ggplot(aes(x = gdpPercap, y = lifeExp, color = continent)) +
  geom_point(aes(size = pop), alpha = 0.6) +
  geom_smooth(method = "lm", se = FALSE, color = "gray30", linetype = "dashed") +
  scale_x_log10(labels = dollar_format()) +
  scale_color_manual(values = continent_colors) +
  scale_size_continuous(range = c(1, 10), guide = "none") +
  labs(subtitle = "D. GDP vs Life Expectancy (2007)",
       x = "GDP per Capita (log)", y = "Life Expectancy") +
  theme_minimal(base_size = 10) +
  theme(legend.position = "none")

# Shared legend
legend_plot <- ggplot(gapminder_2007, aes(x = 1, y = 1, color = continent)) +
  geom_point(size = 5) +
  scale_color_manual(values = continent_colors, name = "Continent") +
  theme_void() +
  theme(legend.position = "bottom", legend.direction = "horizontal")

shared_legend <- cowplot::get_legend(legend_plot)

# Combine all panels
(panel1 | panel2) / (panel3 | panel4) / wrap_elements(shared_legend) +
  plot_layout(heights = c(1, 1, 0.15)) +
  plot_annotation(
    title = "Global Development Story: 1952-2007",
    subtitle = "From Post-War to Globalization: How the World Changed",
    caption = "Source: Gapminder | Visualization: R Advanced Visualization Project",
    theme = theme(
      plot.title = element_text(size = 20, face = "bold", hjust = 0.5),
      plot.subtitle = element_text(size = 14, color = "gray40", hjust = 0.5),
      plot.caption = element_text(size = 10, face = "italic")
    )
  )
Global Development Story: 1952-2007

Global Development Story: 1952-2007


9 Conclusions

9.1 Key Findings

  1. Global Convergence: Life expectancy has increased across all continents, with developing regions making significant strides in catching up to developed nations.

  2. Persistent Gaps: Despite progress, substantial disparities remain — particularly between Africa and other continents.

  3. Non-linear Relationships: The GDP-life expectancy relationship shows diminishing returns at higher income levels, suggesting health gains require more than economic growth alone.

  4. Historical Events Matter: Conflicts (Cambodia, Rwanda) and policy changes create visible disruptions in otherwise upward trends.

9.2 Visualization Techniques Summary

Technique Package Use Case
Ridgeline plots ggridges Distribution evolution over time
Beeswarm plots ggbeeswarm Individual data points without overlap
Zoom facets ggforce Focus on specific regions while maintaining context
Highlighting gghighlight Narrative-driven emphasis on specific data
Mark annotations ggforce Automated clustering visualization
Rich text ggtext Enhanced typography in labels
Animation gganimate Temporal dynamics
Interactivity ggiraph, plotly User exploration

10 Session Information

sessionInfo()
## R version 4.5.0 (2025-04-11 ucrt)
## Platform: x86_64-w64-mingw32/x64
## Running under: Windows 11 x64 (build 26100)
## 
## Matrix products: default
##   LAPACK version 3.12.1
## 
## locale:
## [1] LC_COLLATE=English_United Kingdom.utf8 
## [2] LC_CTYPE=English_United Kingdom.utf8   
## [3] LC_MONETARY=English_United Kingdom.utf8
## [4] LC_NUMERIC=C                           
## [5] LC_TIME=English_United Kingdom.utf8    
## 
## time zone: Europe/Warsaw
## tzcode source: internal
## 
## attached base packages:
## [1] stats     graphics  grDevices utils     datasets  methods   base     
## 
## other attached packages:
##  [1] scales_1.4.0       ggthemes_5.2.0     RColorBrewer_1.1-3 viridis_0.6.5     
##  [5] viridisLite_0.4.2  htmlwidgets_1.6.4  plotly_4.11.0      ggiraph_0.9.3     
##  [9] ggtext_0.1.2       ggrepel_0.9.6      gghighlight_0.5.0  patchwork_1.3.2   
## [13] ggbeeswarm_0.7.3   ggforce_0.5.0      ggridges_0.5.7     gganimate_1.0.11  
## [17] gapminder_1.0.1    lubridate_1.9.4    forcats_1.0.1      stringr_1.5.1     
## [21] dplyr_1.1.4        purrr_1.0.4        readr_2.1.5        tidyr_1.3.1       
## [25] tibble_3.2.1       ggplot2_4.0.1      tidyverse_2.0.0   
## 
## loaded via a namespace (and not attached):
##  [1] tidyselect_1.2.1        vipor_0.4.7             farver_2.1.2           
##  [4] S7_0.2.1                fastmap_1.2.0           lazyeval_0.2.2         
##  [7] tweenr_2.0.3            fontquiver_0.2.1        digest_0.6.37          
## [10] timechange_0.3.0        lifecycle_1.0.4         magrittr_2.0.3         
## [13] compiler_4.5.0          rlang_1.1.6             sass_0.4.10            
## [16] progress_1.2.3          tools_4.5.0             yaml_2.3.10            
## [19] data.table_1.17.4       knitr_1.50              prettyunits_1.2.0      
## [22] labeling_0.4.3          xml2_1.5.1              withr_3.0.2            
## [25] grid_4.5.0              polyclip_1.10-7         gdtools_0.4.4          
## [28] MASS_7.3-65             cli_3.6.5               rmarkdown_2.29         
## [31] crayon_1.5.3            generics_0.1.4          rstudioapi_0.17.1      
## [34] httr_1.4.7              tzdb_0.5.0              commonmark_2.0.0       
## [37] cachem_1.1.0            splines_4.5.0           vctrs_0.6.5            
## [40] Matrix_1.7-3            jsonlite_2.0.0          fontBitstreamVera_0.1.1
## [43] litedown_0.9            hms_1.1.3               beeswarm_0.4.0         
## [46] crosstalk_1.2.1         systemfonts_1.3.1       jquerylib_0.1.4        
## [49] glue_1.8.0              gifski_1.32.0-2         codetools_0.2-20       
## [52] cowplot_1.1.3           stringi_1.8.7           gtable_0.3.6           
## [55] pillar_1.10.2           htmltools_0.5.8.1       R6_2.6.1               
## [58] evaluate_1.0.3          lattice_0.22-6          markdown_2.0           
## [61] gridtext_0.1.5          fontLiberation_0.1.0    bslib_0.9.0            
## [64] Rcpp_1.1.1              gridExtra_2.3           nlme_3.1-168           
## [67] mgcv_1.9-1              xfun_0.55               pkgconfig_2.0.3

Document generated on 2026-01-23 using R Markdown.