Niveau de vie et pauvreté en 2024 - Les niveaux de vie augmentent sans freiner les inégalités

Données - INSEE

Figure 1a et figure 1b

IPC

Code
# ---- 1. Données Figure 1a (avant redistribution) et Figure 1b (après redistribution) ----
fig1a <- ip2117$data[[2]] %>%
  rename(annee = 1, D1 = 2, D5 = 3, D9 = 4) %>%
  mutate(annee = as.numeric(annee))

fig1b <- ip2117$data[[3]] %>%
  rename(annee = 1, D1 = 2, D5 = 3, D9 = 4) %>%
  mutate(annee = as.numeric(annee))

# ---- 2. Mise en forme longue ----
mise_en_forme <- function(df, suffixe) {
  df %>%
    pivot_longer(cols = c(D1, D5, D9), names_to = "decile", values_to = "valeur") %>%
    mutate(
      decile = factor(decile, levels = c("D5", "D9", "D1")),
      label = paste0(decile, " ", suffixe)
    )
}

long_1a <- mise_en_forme(fig1a, "avant redistribution")
long_1b <- mise_en_forme(fig1b, "après redistribution")

couleurs <- c("D5" = "#E8737A", "D9" = "#1B3F8B", "D1" = "#B8860B")

# ---- 3. Fonction de graphique générique ----
graphe_niveau_vie <- function(data, labels_df, titre) {
  ggplot(data, aes(x = annee, y = valeur, color = decile, group = decile)) +
    geom_hline(yintercept = 100, color = "black", linewidth = 0.5) +
    geom_line(linewidth = 1.1) +
    geom_text(
      data = labels_df,
      aes(x = annee, y = valeur, label = label, color = decile),
      fontface = "bold", size = 5.2, hjust = 0, show.legend = FALSE
    ) +
    scale_color_manual(values = couleurs) +
    scale_x_continuous(
      breaks = seq(1996, 2024, by = 4),
      limits = c(1996, 2025),
      expand = expansion(mult = c(0.01, 0.02))
    ) +
    scale_y_continuous(
      breaks = seq(70, 115, by = 5),
      limits = c(70, 115),
      expand = c(0, 0)
    ) +
    labs(
      x = NULL, y = NULL,
      title = titre,
      subtitle = "indice base 100 en 2008, en euros constants"
    ) +
    theme_minimal(base_size = 15) +
    theme(
      legend.position = "none",
      panel.grid.minor = element_blank(),
      panel.grid.major.x = element_blank(),
      panel.grid.major.y = element_line(color = "grey85", linewidth = 0.4),
      axis.text = element_text(color = "grey20", size = 15),
      axis.text.x = element_text(margin = margin(t = 6)),
      plot.title = element_text(face = "bold", size = 19, color = "grey30", margin = margin(b = 10)),
      plot.subtitle = element_text(size = 15, color = "grey30", margin = margin(b = 12)),
      plot.background = element_rect(fill = "#F5F5F3", color = NA),
      panel.background = element_rect(fill = "#F5F5F3", color = NA),
      plot.margin = margin(15, 20, 10, 10)
    )
}

# ---- 4. Positions des étiquettes sur chaque courbe (calées à l'oeil sur l'original) ----
labels_1a <- tribble(
  ~annee, ~valeur, ~label,                      ~decile,
  1997.2, 103.5,   "D5 avant redistribution",    "D5",
  2013,   100.5,   "D9 avant redistribution",    "D9",
  2004.5, 87.3,    "D1 avant redistribution",    "D1"
)

labels_1b <- tribble(
  ~annee, ~valeur, ~label,                       ~decile,
  2007.3, 106.3,   "D5 après redistribution",    "D5",
  2010.3, 91.3,    "D9 après redistribution",    "D9",
  2003.8, 81.3,    "D1 après redistribution",    "D1"
)

p_1a <- graphe_niveau_vie(long_1a, labels_1a, "a. Avant redistribution")
p_1b <- graphe_niveau_vie(long_1b, labels_1b, "b. Après redistribution")

p_combine <- gridExtra::arrangeGrob(p_1a, p_1b, ncol = 2)  # s'affiche automatiquement en session interactive
 

p_combine
# TableGrob (1 x 2) "arrange": 2 grobs
#   z     cells    name           grob
# 1 1 (1-1,1-1) arrange gtable[layout]
# 2 2 (1-1,2-2) arrange gtable[layout]
Code
ggsave("~/Downloads/ip2117_IPC.png", p_combine,
       width = 16, height = 8, dpi = 200, bg = "#F5F5F3")

IPCH

Code
# ---- 1. Données Figure 1a et 1b telles que publiées par l'Insee (déflaté IPC) ----
fig1a <- ip2117$data[[2]] %>%
  rename(annee = 1, D1 = 2, D5 = 3, D9 = 4) %>%
  mutate(annee = as.numeric(annee))

fig1b <- ip2117$data[[3]] %>%
  rename(annee = 1, D1 = 2, D5 = 3, D9 = 4) %>%
  mutate(annee = as.numeric(annee))

# ---- 2. Ratio IPC/IPCH, rebasé à 1 en 2008 (année de référence des figures) ----
prix <- `IPCH-IPC-2025-ensemble-A` %>%
  mutate(annee = as.numeric(format(date, "%Y"))) %>%
  select(annee, INDICATEUR, OBS_VALUE) %>%
  pivot_wider(names_from = INDICATEUR, values_from = OBS_VALUE) %>%
  mutate(ratio = IPC / IPCH) %>%
  mutate(ratio_rebase = ratio / ratio[annee == 2008])

# ---- 3. Reconversion IPC -> IPCH : niveau de vie déflaté IPCH = niveau de vie déflaté IPC x (IPC/IPCH), rebasé 2008 = 100 ----
deflate_ipch <- function(df) {
  df %>%
    left_join(prix %>% select(annee, ratio_rebase), by = "annee") %>%
    mutate(across(c(D1, D5, D9), ~ .x * ratio_rebase)) %>%
    select(-ratio_rebase)
}

fig1a_ipch <- deflate_ipch(fig1a)
fig1b_ipch <- deflate_ipch(fig1b)

# ---- 4. Mise en forme longue ----
mise_en_forme <- function(df, suffixe) {
  df %>%
    pivot_longer(cols = c(D1, D5, D9), names_to = "decile", values_to = "valeur") %>%
    mutate(
      decile = factor(decile, levels = c("D5", "D9", "D1")),
      label = paste0(decile, " ", suffixe)
    )
}

long_1a <- mise_en_forme(fig1a_ipch, "avant redistribution")
long_1b <- mise_en_forme(fig1b_ipch, "après redistribution")

couleurs <- c("D5" = "#E8737A", "D9" = "#1B3F8B", "D1" = "#B8860B")

# ---- 5. Fonction de graphique générique (même habillage que la réplique IPC) ----
graphe_niveau_vie <- function(data, labels_df, titre) {
  ggplot(data, aes(x = annee, y = valeur, color = decile, group = decile)) +
    geom_hline(yintercept = 100, color = "black", linewidth = 0.5) +
    geom_line(linewidth = 1.1) +
    geom_text(
      data = labels_df,
      aes(x = annee, y = valeur, label = label, color = decile),
      fontface = "bold", size = 5.2, hjust = 0, show.legend = FALSE
    ) +
    scale_color_manual(values = couleurs) +
    scale_x_continuous(
      breaks = seq(1996, 2024, by = 4),
      limits = c(1996, 2025),
      expand = expansion(mult = c(0.01, 0.02))
    ) +
    scale_y_continuous(
      breaks = seq(70, 115, by = 5),
      limits = c(70, 115),
      expand = c(0, 0)
    ) +
    labs(
      x = NULL, y = NULL,
      title = titre,
      subtitle = "indice base 100 en 2008, en euros constants (déflaté IPCH)"
    ) +
    theme_minimal(base_size = 15) +
    theme(
      legend.position = "none",
      panel.grid.minor = element_blank(),
      panel.grid.major.x = element_blank(),
      panel.grid.major.y = element_line(color = "grey85", linewidth = 0.4),
      axis.text = element_text(color = "grey20", size = 15),
      axis.text.x = element_text(margin = margin(t = 6)),
      plot.title = element_text(face = "bold", size = 19, color = "grey30", margin = margin(b = 10)),
      plot.subtitle = element_text(size = 14, color = "grey30", margin = margin(b = 12)),
      plot.background = element_rect(fill = "#F5F5F3", color = NA),
      panel.background = element_rect(fill = "#F5F5F3", color = NA),
      plot.margin = margin(15, 20, 10, 10)
    )
}

# ---- 6. Étiquettes sur les courbes (mêmes positions que la version IPC ; les courbes bougent peu) ----
labels_1a <- tribble(
  ~annee, ~valeur, ~label,                      ~decile,
  1997.2, 103.5,   "D5 avant redistribution",    "D5",
  2013,   100.5,   "D9 avant redistribution",    "D9",
  2004.5, 87.3,    "D1 avant redistribution",    "D1"
)

labels_1b <- tribble(
  ~annee, ~valeur, ~label,                       ~decile,
  2007.3, 106.3,   "D5 après redistribution",    "D5",
  2010.3, 91.3,    "D9 après redistribution",    "D9",
  2003.8, 81.3,    "D1 après redistribution",    "D1"
)

p_1a <- graphe_niveau_vie(long_1a, labels_1a, "a. Avant redistribution")
p_1b <- graphe_niveau_vie(long_1b, labels_1b, "b. Après redistribution")

p_combine <- gridExtra::arrangeGrob(p_1a, p_1b, ncol = 2)  # s'affiche automatiquement en session interactive

ggsave("~/Downloads/ip2117_IPCH.png", p_combine,
       width = 16, height = 8, dpi = 200, bg = "#F5F5F3")

Figure 1b

IPC

Code
# ---- 1. Données figure 1b (déflatée IPC, telle que publiée par l'Insee) ----
fig1b <- ip2117$data[[3]] %>%
  rename(annee = 1, D1 = 2, D5 = 3, D9 = 4) %>%
  mutate(annee = as.numeric(annee))
 
# ---- 2. Indices de prix : ratio IPC/IPCH, rebasé à 1 en 2008 ----
# (2008 est l'année de référence de la figure 1b -> il faut que le ratio
#  vaille 1 cette année-là pour ne pas décaler artificiellement le niveau 100)
prix <- `IPCH-IPC-2025-ensemble-A` %>%
  mutate(annee = as.numeric(format(date, "%Y"))) %>%
  select(annee, INDICATEUR, OBS_VALUE) %>%
  pivot_wider(names_from = INDICATEUR, values_from = OBS_VALUE) %>%
  mutate(ratio = IPC / IPCH) %>%
  mutate(ratio_rebase = ratio / ratio[annee == 2008])
 
# ---- 3. Reconversion : passage d'un déflatage IPC à un déflatage IPCH ----
# niveau de vie déflaté IPCH = niveau de vie déflaté IPC x (IPC/IPCH), rebasé pour que 2008 = 100
fig1b_ipch <- fig1b %>%
  left_join(prix %>% select(annee, ratio_rebase), by = "annee") %>%
  mutate(across(c(D1, D5, D9), ~ .x * ratio_rebase)) %>%
  select(-ratio_rebase)
 
# ---- 4. Mise en forme longue commune aux deux graphiques ----
mise_en_forme <- function(df) {
  df %>%
    pivot_longer(cols = c(D1, D5, D9), names_to = "decile", values_to = "valeur") %>%
    mutate(
      decile = factor(decile, levels = c("D5", "D9", "D1")),
      label = case_when(
        decile == "D1" ~ "D1 après redistribution",
        decile == "D5" ~ "D5 après redistribution",
        decile == "D9" ~ "D9 après redistribution"
      )
    )
}
 
long_ipc  <- mise_en_forme(fig1b)
long_ipch <- mise_en_forme(fig1b_ipch)
 
couleurs <- c(
  "D5 après redistribution" = "#E8737A",
  "D9 après redistribution" = "#1B3F8B",
  "D1 après redistribution" = "#B8860B"
)
 
# ---- 5. Fonction de graphique générique (même habillage que la réplique initiale) ----
graphe_niveau_vie <- function(data, labels_df, titre) {
  ggplot(data, aes(x = annee, y = valeur, color = label, group = label)) +
    geom_hline(yintercept = 100, color = "black", linewidth = 0.5) +
    geom_line(linewidth = 1.1) +
    geom_text(
      data = labels_df,
      aes(x = annee, y = valeur, label = label, color = label),
      fontface = "bold", size = 5, hjust = 0, show.legend = FALSE
    ) +
    scale_color_manual(values = couleurs) +
    scale_x_continuous(
      breaks = seq(1996, 2024, by = 4),
      limits = c(1996, 2025),
      expand = expansion(mult = c(0.01, 0.02))
    ) +
    scale_y_continuous(
      breaks = seq(70, 115, by = 5),
      limits = c(70, 115),
      expand = c(0, 0)
    ) +
    labs(x = NULL, y = NULL, title = titre) +
    theme_minimal(base_size = 15) +
    theme(
      legend.position = "none",
      panel.grid.minor = element_blank(),
      panel.grid.major.x = element_blank(),
      panel.grid.major.y = element_line(color = "grey85", linewidth = 0.4),
      axis.text = element_text(color = "grey20", size = 14),
      axis.text.x = element_text(margin = margin(t = 6)),
      plot.title = element_text(face = "bold", size = 15, margin = margin(b = 8)),
      plot.background = element_rect(fill = "#F5F5F3", color = NA),
      panel.background = element_rect(fill = "#F5F5F3", color = NA),
      plot.margin = margin(15, 20, 10, 10)
    )
}
 
labels_ipc <- tribble(
  ~annee, ~valeur, ~label, ~decile,
  2007.3, 106.3,   "D5 après redistribution", "D5 après redistribution",
  2010.3, 91.3,    "D9 après redistribution", "D9 après redistribution",
  2003.8, 81.3,    "D1 après redistribution", "D1 après redistribution"
)
 
# labels repositionnés au besoin pour le graphique IPCH (les courbes bougent légèrement)
labels_ipch <- labels_ipc
 
p_ipc  <- graphe_niveau_vie(long_ipc,  labels_ipc,  "Déflaté par l'IPC (Insee, original)")
p_ipch <- graphe_niveau_vie(long_ipch, labels_ipch, "Déflaté par l'IPCH")
 
p_combine <- gridExtra::arrangeGrob(p_ipc, p_ipch, ncol = 2)

p_ipc

IPCH

Code
p_ipch

Combine horizontally

Code
ggpubr::ggarrange(p_ipc, p_ipch)