File:Healthy life expectancy bar chart -world.svg

From HandWiki

Original file (SVG file, nominally 1,920 × 785 pixels, file size: 41 KB)

This file is from a shared repository and may be used by other projects. The description on its file description page there is shown below.

Summary

Description
Date
Source Own work
Author Smasongarrison, Lady3mlnm
Other versions Source Version

Source code

The logo of R – programming language for statistical analysis
The logo of R – programming language for statistical analysis
This media was created with R (programming language for statistical analysis)
Here is a listing of the source used to create this file.

Deutsch  English  +/−

library(tidyverse)

df <- tribble(
  ~country, ~LE,  ~HALE,
  "Japan",        84.5, 73.6,
  "South Korea",  83.7, 72.5,
  "Spain",        83.1, 71.7,
  "Italy",        83.0, 71.4,
  "Australia",    82.6, 70.3,
  "Israel",       82.6, 71.5,
  "France",       82.5, 70.7,
  "UAE",          81.4, 69.7,
  "UK",           81.2, 69.7,
  "Germany",      81.0, 69.4,
  "USA",          78.7, 66.0,
  "Colombia",     78.0, 67.9,
  "Iran",         77.8, 66.6,
  "Turkey",       77.6, 67.2,
  "China",        77.3, 68.5,
  "Argentina",    77.0, 66.9,
  "Saudi Arabia", 76.9, 66.2,
  "Thailand",     76.9, 67.1,
  "Algeria",      76.5, 66.1,
  "Mexico",       75.8, 65.5,
  "Brazil",       75.5, 64.5,
  "Bangladesh",   74.0, 64.0,
  "Vietnam",      73.7, 65.4,
  "Russia",       73.2, 63.7,
  "Ukraine",      73.0, 63.5,
  "Iraq",         72.9, 62.4,
  "Egypt",        71.6, 62.5,
  "Indonesia",    71.4, 63.3,
  "India",        70.7, 60.9,
  "Sudan",        69.5, 60.1,
  "Philippines",  69.4, 61.3,
  "Ethiopia",     68.8, 59.9,
  "Myanmar",      68.8, 60.7,
  "Pakistan",     67.0, 57.8,
  "Tanzania",     66.8, 58.3,
  "Kenya",        66.5, 58.2,
  "Uganda",       66.1, 57.5,
  "South Africa", 65.8, 56.3,
  "Nigeria",      63.1, 54.8,
  "DR Congo",     61.8, 53.5
) |>
  mutate(
    country = factor(country, levels = country),
    disability = LE - HALE
  )

plot_df <- df |>
  select(country, HALE, disability) |>
  pivot_longer(
    cols = c(disability,HALE),
    names_to = "component",
    values_to = "years"
  ) |>
  mutate(
    component = factor(
      component,
      levels = c( "disability", "HALE"),
      labels = c("LE with disability","HALE")
    )
  )

base_size <- 5
base_text <- 15

core_plot <- ggplot(plot_df, aes(x = country, y = years, fill = component)) +
  geom_col(width = 0.9, color = "black", linewidth = 0.25) +
  geom_text(
    data = df,
    aes(x = country, y = HALE - 1.3, label = sprintf("%.1f", HALE)),
    inherit.aes = FALSE,
    color = "white",
    fontface = "bold",
    size = base_size
  ) +
  geom_text(
    data = df,
    aes(x = country, y = LE - 1.2, label = sprintf("%.1f", LE)),
    inherit.aes = FALSE,
    color = "black",
    size = base_size
  ) +
  scale_fill_manual(
    values = c("HALE" = "green4", "LE with disability" = "orange"),
    breaks = c("HALE", "LE with disability")
  ) +
  scale_y_continuous(
    limits = c(0, 90),
    breaks = seq(0, 80, 10),
    minor_breaks = seq(0, 90, 5),
    sec.axis = dup_axis()
  ) +
  labs(
    title = "Life expectancy (LE) and healthy life expectancy (HALE) in some countries of the world in 2019",
    x = NULL,
    y = NULL,
    fill = NULL
  ) +
  theme_minimal(base_size = base_text) +
  theme(
    plot.title = element_text(hjust = 0.5, size = base_text),
    axis.text.x = element_text(angle = 90, vjust = 0.5, hjust = 1, color = "black"),
    axis.text.y = element_text(color = "black"),
    panel.grid.major.x = element_blank(),
    panel.grid.minor.x = element_blank(),
    panel.grid.major.y = element_line(color = "grey75", linewidth = 0.4),
    panel.grid.minor.y = element_line(color = "grey90", linewidth = 0.3),
    panel.border = element_rect(color = "grey30", fill = NA, linewidth = 0.5),
    legend.position = c(0.93, 0.97),
    legend.justification = c("right", "top"),
    legend.background = element_rect(color = "grey80", fill = "white"),
    legend.key.size = unit(1, "lines"),
    plot.margin = margin(5, 5, 5, 5)
  )

ggsave(
  filename = "healthy_life_expectancy_bar_chart_redone.svg",
  plot = core_plot,
  width = 22/1.1,
  height = 9/1.1,
  dpi = 300
)

Licensing

I, the copyright holder of this work, hereby publish it under the following license:
Creative Commons CC-Zero This file is made available under the Creative Commons CC0 1.0 Universal Public Domain Dedication.
The person who associated a work with this deed has dedicated the work to the public domain by waiving all of their rights to the work worldwide under copyright law, including all related and neighboring rights, to the extent allowed by law. You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission.

Captions

Life expectancy and healthy life expectancy (HALE) in some countries of the world in 2019

Items portrayed in this file

depicts

29 April 2026

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current17:45, 29 April 2026Thumbnail for version as of 17:45, 29 April 20261,920 × 785 (41 KB)imagescommonswiki>Smasongarrisonincrease fontsize // Editing SVG source code using c:User:Rillke/SVGedit.js

The following file is a duplicate of this file (more details):

The following page uses this file:

Metadata