The data on life expectancy at birth and at various age intervals (10, 20, 30, …, 80) was sourced from “Our World in Data” and Gapminder.org. The line graph, which plots life expectancy over the last seven decades (1950, 1960, …, 2020), reveals that significant improvements in life expectancy have predominantly occurred in the younger age groups, particularly from birth to age 10. This suggests that advancements in treating childhood diseases and increased vaccination efforts have been crucial. Conversely, there has been minimal improvement in life expectancy for those beyond 70 and 80 years. The most substantial gains in life expectancy for younger age groups were observed during the 1960 to 1970 decade.
How I made this graphic?
Getting the data
Code
# Data Import and Wrangling Toolslibrary(tidyverse) # All things tidylibrary(owidR) # Get data from Our World in R# Final plot toolslibrary(scales) # Nice Scales for ggplot2library(fontawesome) # Icons display in ggplot2library(ggtext) # Markdown text support for ggplot2library(showtext) # Display fonts in ggplot2library(colorspace) # To lighten and darken colours# The Expansion pack to ggplot2library(ggforce) # to learn some new geom-extensions# Searrch for the life expectancy indicators in Our World in Datatemp1 <-owid_search("life expectancy") |>as_tibble()# Select an indicatorsel_indicator <- temp1 |>filter(str_detect(title, "Remaining")) |>slice_head(n =1) |>pull(chart_id)# Raw Datatemp <-owid(chart_id = sel_indicator)
Visualization Parameters
Code
# Font for titlesfont_add_google("Glegoo",family ="title_font") # Font for the captionfont_add_google("Stint Ultra Condensed",family ="caption_font") # Font for plot textfont_add_google("Maiden Orange",family ="body_font") showtext_auto()# Colour Palettemypal <- paletteer::paletteer_d("MoMAColors::Alkalay2")# Background Colourbg_col <- mypal[1] |>lighten(0.75)text_col <- mypal[8]text_hil <- mypal[7]# Base Text Sizebts <-80plot_title <-"Decades of Difference:\nHow Life Expectancy Has Evolved"plot_subtitle <-str_wrap("Global life expectancy at different age intervals from 1950 to 2020. We see that significant improvements in life expectancy have occurred primarily in younger age groups (0 to 10 years), due to advancements in childhood disease treatments and vaccinations. In contrast, life expectancy beyond 70 and 80 years has seen minimal improvement.", 60)str_view(plot_subtitle)# Caption stuff for the plotsysfonts::font_add(family ="Font Awesome 6 Brands",regular = here::here("docs", "Font Awesome 6 Brands-Regular-400.otf"))github <-""github_username <-"aditya-dahiya"xtwitter <-""xtwitter_username <-"@adityadahiyaias"social_caption_1 <- glue::glue("<span style='font-family:\"Font Awesome 6 Brands\";'>{github};</span> <span style='color: {text_hil}'>{github_username} </span>")social_caption_2 <- glue::glue("<span style='font-family:\"Font Awesome 6 Brands\";'>{xtwitter};</span> <span style='color: {text_hil}'>{xtwitter_username}</span>")plot_caption <-paste0("**Data:** Our World in Data | Gapminder | ","**Code:** ", social_caption_1, " | **Graphics:** ", social_caption_2 )