Apartado 3.5
Datos y paleta de colores — PIBE
db_1_dinamica = read_excel("db_1_dinamica.xlsx")
#View(db_1_dinamica)
paleta_colores = c(
"CDMX" = "#061a40",
"EDOMEX" = "#0353a4",
"HIDALGO" = "#0077b6",
"MORELOS" = "#5b4b9e",
"PUEBLA" = "#b7a9e0",
"TLAXCALA" = "#9aafd1"
)
fuente_1 = "Fuente: INEGI (2024), Sistema de Cuentas Nacionales de MĂ©xico. Producto Interno Bruto por Entidad Federativa. ElaboraciĂ³n propia."
GrĂ¡fica 6. Tasa de crecimiento del PIBE (RegiĂ³n Centro)
pibe = read_excel("db_1_dinamica.xlsx", sheet = "PIBE")
pibe_crecimiento = pibe %>%
filter(Año >= 2014) %>%
select(
Año,
T_Nacional,
T_PIB_CDMX,
T_PIB_EDOMEX,
T_PIB_HIDALGO,
T_PIB_MORELOS,
T_PIB_PUEBLA,
T_PIB_TLAXCALA
) %>%
pivot_longer(
cols = -Año,
names_to = "Entidad",
values_to = "Tasa_crecimiento"
) %>%
mutate(
Entidad = case_when(
Entidad == "T_Nacional" ~ "Nacional",
Entidad == "T_PIB_CDMX" ~ "CDMX",
Entidad == "T_PIB_EDOMEX" ~ "Estado de México",
Entidad == "T_PIB_HIDALGO" ~ "Hidalgo",
Entidad == "T_PIB_MORELOS" ~ "Morelos",
Entidad == "T_PIB_PUEBLA" ~ "Puebla",
Entidad == "T_PIB_TLAXCALA" ~ "Tlaxcala",
TRUE ~ Entidad
)
)
paleta_grafica_1 = c(
"Nacional" = "red",
"CDMX" = "#061a40",
"Estado de México" = "#0353a4",
"Hidalgo" = "#0077b6",
"Morelos" = "#5b4b9e",
"Puebla" = "#b7a9e0",
"Tlaxcala" = "#9aafd1"
)
grafica_1 = ggplot(
pibe_crecimiento,
aes(x = Año, y = Tasa_crecimiento, color = Entidad)
) +
geom_line(linewidth = 0.6) +
geom_point(size = 0.5) +
geom_hline(yintercept = 0, linetype = "dashed", color = "grey50") +
scale_color_manual(values = paleta_grafica_1) +
scale_x_continuous(breaks = unique(pibe_crecimiento$Año)) +
labs(
title = "GrĂ¡fica 6. Tasa de crecimiento del PIBE (RegiĂ³n Centro)",
subtitle = "VariaciĂ³n porcentual anual en valores constantes, 2014-2024",
x = "Año",
y = "Crecimiento anual (%)",
color = "Entidad",
caption = fuente_1
) +
theme_minimal() +
theme(
plot.title = element_text(face = "bold", hjust = 0.5),
plot.subtitle = element_text(hjust = 0.5),
plot.caption = element_text(hjust = 0, size = 7),
axis.text.x = element_text(angle = 45, hjust = 1),
legend.position = "bottom",
legend.title = element_text(size = 9),
legend.text = element_text(size = 8)
)
grafica_1

Anexo 1. Crecimiento promedio anual del PIBE por entidad
pibe <- read_excel(
"db_1_dinamica.xlsx",
sheet = "PIBE"
)
pibe_estatal <- pibe %>%
select(
Año,
PIB_CDMX,
PIB_EDOMEX,
PIB_HIDALGO,
PIB_MORELOS,
PIB_PUEBLA,
PIB_TLAXCALA
) %>%
pivot_longer(
cols = starts_with("PIB_"),
names_to = "Entidad",
values_to = "PIBE"
) %>%
mutate(
Entidad = str_remove(
Entidad,
"PIB_"
)
)
tcma_pibe <- pibe_estatal %>%
mutate(
Periodo = case_when(
Año >= 2013 & Año <= 2019 ~ "2013-2019",
Año >= 2020 & Año <= 2024 ~ "2020-2024",
TRUE ~ NA_character_
)
) %>%
filter(
!is.na(Periodo)
) %>%
group_by(
Entidad,
Periodo
) %>%
arrange(
Año,
.by_group = TRUE
) %>%
summarise(
Año_inicial = first(Año),
Año_final = last(Año),
PIBE_inicial = first(PIBE),
PIBE_final = last(PIBE),
Numero_años = Año_final - Año_inicial,
TCMA = (
(
PIBE_final /
PIBE_inicial
) ^ (1 / Numero_años) - 1
) * 100,
.groups = "drop"
)
tcma_pibe_grafica <- tcma_pibe %>%
select(
Entidad,
Periodo,
TCMA
) %>%
pivot_wider(
names_from = Periodo,
values_from = TCMA
) %>%
mutate(
Entidad_nombre = recode(
Entidad,
"CDMX" = "CDMX",
"EDOMEX" = "Estado de México",
"HIDALGO" = "Hidalgo",
"MORELOS" = "Morelos",
"PUEBLA" = "Puebla",
"TLAXCALA" = "Tlaxcala"
),
Cambio = `2020-2024` - `2013-2019`,
Entidad_nombre = reorder(
Entidad_nombre,
`2020-2024`
)
)
grafica_tcma_pibe <- ggplot(
tcma_pibe_grafica,
aes(
y = Entidad_nombre
)
) +
geom_vline(
xintercept = 0,
color = "gray55",
linetype = "dashed",
linewidth = 0.5
) +
geom_segment(
aes(
x = `2013-2019`,
xend = `2020-2024`,
yend = Entidad_nombre
),
color = "gray70",
linewidth = 1
) +
geom_point(
aes(
x = `2013-2019`
),
color = "gray45",
size = 3.5
) +
geom_point(
aes(
x = `2020-2024`,
color = Entidad
),
size = 4
) +
geom_text(
aes(
x = `2013-2019`,
label = paste0(
number(
`2013-2019`,
accuracy = 0.1
),
"%"
)
),
color = "gray30",
hjust = 1.25,
size = 2.8
) +
geom_text(
aes(
x = `2020-2024`,
label = paste0(
number(
`2020-2024`,
accuracy = 0.1
),
"%"
)
),
hjust = -0.25,
color = "black",
size = 2.8
) +
scale_color_manual(
values = paleta_colores,
guide = "none"
) +
scale_x_continuous(
labels = label_percent(
scale = 1,
accuracy = 0.5
),
expand = expansion(
mult = c(0.20, 0.20)
)
) +
labs(
title = "Crecimiento promedio anual del PIBE por entidad",
subtitle = "ComparaciĂ³n antes y despuĂ©s de 2020",
x = "Tasa de crecimiento promedio anual",
y = NULL,
caption = paste0(
"Nota: el punto gris representa el periodo 2013-2019 y el punto de color corresponde a 2020-2024.\nEl CAGR se calculĂ³ con el PIBE a precios constantes. \nFuente: elaboraciĂ³n propia con datos de INEGI (2024)."
)
) +
theme_minimal() +
theme(
panel.grid.minor = element_blank(),
panel.grid.major.y = element_blank(),
plot.title = element_text(
face = "bold",
size = 12,
hjust = 0.5
),
plot.subtitle = element_text(
size = 10,
hjust = 0.5
),
plot.caption = element_text(
size = 7.5,
hjust = 0.5,
lineheight = 1.1
),
axis.title = element_text(
size = 10
),
axis.text.x = element_text(
size = 8
),
axis.text.y = element_text(
size = 9,
color = "black"
),
plot.margin = margin(
10,
35,
10,
35
)
)
grafica_tcma_pibe

Apartado 3.6
GrĂ¡fica 7. Tasa de informalidad laboral
informalidad = read_excel("db_2_dinamica.xlsx", sheet = "Tasa de informalidad")
informalidad_larga = informalidad %>%
pivot_longer(
cols = -Año,
names_to = "estado",
names_pattern = "T_INFORMAL_(.*)",
values_to = "tasa_informalidad"
) %>%
mutate(
estado = recode(estado, !!!nombres_estados),
anio = as.numeric(str_sub(Año, 1, 4)),
trimestre = as.numeric(str_sub(Año, 6, 7)),
fecha = as.Date(paste0(anio, "-", ((trimestre - 1) * 3 + 1), "-01")),
periodo = paste0(anio, " T", trimestre)
)
grafica_informalidad = ggplot(
informalidad_larga,
aes(x = fecha, y = tasa_informalidad, color = estado, group = estado)
) +
geom_line(linewidth = 1) +
scale_color_manual(values = paleta_colores) +
scale_y_continuous(labels = function(x) paste0(x, "%")) +
scale_x_date(date_breaks = "1 year", date_labels = "%Y") +
labs(
title = "GrĂ¡fica 7. Tasa de informalidad laboral por entidad federativa",
subtitle = "RegiĂ³n Centro, 2015-2026",
x = "Año",
y = "Porcentaje de la poblaciĂ³n ocupada",
color = "Entidad federativa",
caption = fuente_2
) +
theme_minimal(base_size = 12) +
theme(
plot.title = element_text(face = "bold", hjust = 0.5, size = 15),
plot.subtitle = element_text(hjust = 0.5, size = 12),
plot.caption = element_text(hjust = 0.5, size = 7),
axis.title.x = element_text(size = 10),
axis.title.y = element_text(size = 10),
axis.text.x = element_text(size = 8, angle = 45, hjust = 1),
axis.text.y = element_text(size = 9),
legend.title = element_text(size = 10),
legend.text = element_text(size = 9),
legend.position = "bottom"
)
grafica_informalidad

Anexo 2. PoblaciĂ³n de 15 años y mĂ¡s con instrucciĂ³n media superior y
superior
educacion_1_larga = educacion_1 %>%
pivot_longer(
cols = -Año,
names_to = c("nivel", "estado"),
names_pattern = "E_(MSUP|SUP)_(.*)",
values_to = "porcentaje"
) %>%
mutate(
estado = recode(estado, !!!nombres_estados),
nivel = recode(
nivel,
"MSUP" = "Media superior",
"SUP" = "Superior"
)
) %>%
filter(Año == 2020)
grafica_educacion_1 = ggplot(
educacion_1_larga,
aes(x = estado, y = porcentaje, fill = nivel)
) +
geom_col(position = position_dodge(width = 0.8), width = 0.7) +
geom_text(
aes(label = paste0(round(porcentaje, 1), "%")),
position = position_dodge(width = 0.8),
hjust = -0.15,
size = 3.3
) +
coord_flip() +
scale_fill_manual(
values = c(
"Media superior" = "#b7a9e0",
"Superior" = "#5b4b9e"
)
) +
scale_y_continuous(
labels = function(x) paste0(round(x, 1), "%"),
expand = expansion(mult = c(0, 0.15))
) +
labs(
title = "PoblaciĂ³n de 15 años y mĂ¡s con instrucciĂ³n media superior y superior",
subtitle = "RegiĂ³n Centro, 2020",
x = NULL,
y = "Porcentaje de la poblaciĂ³n",
fill = "Nivel educativo",
caption = fuente_3
) +
theme_minimal(base_size = 12) +
theme(
plot.title = element_text(face = "bold", hjust = 0.5, size = 11),
plot.subtitle = element_text(hjust = 0.5, size = 10),
plot.caption = element_text(hjust = 0, size = 7),
axis.title.x = element_text(size = 10),
axis.text.x = element_text(size = 9),
axis.text.y = element_text(size = 9),
legend.title = element_text(size = 9),
legend.text = element_text(size = 8),
legend.position = "bottom"
)
grafica_educacion_1

Anexo 3. Grado promedio de escolaridad por entidad
educacion_2_larga = educacion_2 %>%
pivot_longer(
cols = -Año,
names_to = "estado",
names_pattern = "ESCOL_(.*)",
values_to = "grado_promedio"
) %>%
mutate(
estado = recode(estado, !!!nombres_estados)
)
educacion_2_2020 = educacion_2_larga %>%
filter(Año == 2020)
paleta_grafica_edu_2 = c(
"CDMX" = "#061a40",
"Estado de México" = "#0353a4",
"Hidalgo" = "#0077b6",
"Morelos" = "#5b4b9e",
"Puebla" = "#b7a9e0",
"Tlaxcala" = "#9aafd1"
)
grafica_educacion_2 = ggplot(
educacion_2_2020,
aes(x = reorder(estado, grado_promedio), y = grado_promedio, fill = estado)
) +
geom_col(width = 0.7) +
geom_text(
aes(label = round(grado_promedio, 1)),
hjust = -0.15,
size = 3.5
) +
coord_flip() +
scale_fill_manual(values = paleta_grafica_edu_2) +
scale_y_continuous(expand = expansion(mult = c(0, 0.12))) +
labs(
title = "Grado promedio de escolaridad por entidad federativa",
subtitle = "RegiĂ³n Centro, 2020",
x = NULL,
y = "Años promedio de escolaridad",
caption = fuente_3
) +
theme_minimal(base_size = 12) +
theme(
plot.title = element_text(face = "bold", hjust = 0.5),
plot.subtitle = element_text(hjust = 0.5),
plot.caption = element_text(hjust = 0, size = 7),
axis.title.x = element_text(size = 10),
legend.position = "none"
)
grafica_educacion_2

GrĂ¡fica 9. EvoluciĂ³n del salario promedio mensual por tipo de
empleo
## ------------------------------------------------
## 1. Salarios formales e informales
## ------------------------------------------------
salarios <- read_excel(
"db_2_dinamica.xlsx",
sheet = "Salarios"
)
salarios_long <- salarios %>%
select(
Año,
`Tipo de empleo`,
starts_with("SALM_")
) %>%
pivot_longer(
cols = starts_with("SALM_"),
names_to = "Entidad",
values_to = "Salario_promedio"
) %>%
mutate(
Entidad = str_remove(
Entidad,
"SALM_"
),
Entidad = recode(
Entidad,
"CDMX" = "Ciudad de México",
"EDOMEX" = "Estado de México",
"HIDALGO" = "Hidalgo",
"MORELOS" = "Morelos",
"PUEBLA" = "Puebla",
"TLAXCALA" = "Tlaxcala"
),
Año_num = as.numeric(
str_sub(Año, 1, 4)
),
Trimestre = as.numeric(
str_remove(
str_extract(Año, "Q[1-4]"),
"Q"
)
),
Fecha = as.Date(
paste0(
Año_num,
"-",
case_when(
Trimestre == 1 ~ "01-01",
Trimestre == 2 ~ "04-01",
Trimestre == 3 ~ "07-01",
Trimestre == 4 ~ "10-01"
)
)
)
) %>%
filter(
!is.na(Salario_promedio)
)
salario_total <- read_excel(
"db_2_dinamica.xlsx",
sheet = "Salario Total"
)
salario_total_long <- salario_total %>%
pivot_longer(
cols = starts_with("SALM_T_"),
names_to = "Entidad",
values_to = "Salario_total"
) %>%
mutate(
Entidad = str_remove(
Entidad,
"SALM_T_"
),
Entidad = recode(
Entidad,
"CDMX" = "Ciudad de México",
"EDOMEX" = "Estado de México",
"HIDALGO" = "Hidalgo",
"MORELOS" = "Morelos",
"PUEBLA" = "Puebla",
"TLAXCALA" = "Tlaxcala"
),
Año_num = as.numeric(
str_sub(Año, 1, 4)
),
Trimestre = as.numeric(
str_remove(
str_extract(Año, "Q[1-4]"),
"Q"
)
),
Fecha = as.Date(
paste0(
Año_num,
"-",
case_when(
Trimestre == 1 ~ "01-01",
Trimestre == 2 ~ "04-01",
Trimestre == 3 ~ "07-01",
Trimestre == 4 ~ "10-01"
)
)
)
) %>%
filter(
!is.na(Salario_total)
)
grafica_salarios <- ggplot() +
# Salario formal e informal
geom_line(
data = salarios_long,
aes(
x = Fecha,
y = Salario_promedio,
color = `Tipo de empleo`,
group = `Tipo de empleo`
),
linewidth = 0.8
) +
# Salario promedio total
geom_line(
data = salario_total_long,
aes(
x = Fecha,
y = Salario_total,
group = 1
),
color = "red",
linewidth = 0.5,
linetype = "dashed"
) +
facet_wrap(
~Entidad,
scales = "free_y",
ncol = 2
) +
scale_color_manual(
values = c(
"Empleo Formal" = "#0353a4",
"Empleo Informal" = "#5b4b9e"
)
) +
scale_y_continuous(
labels = label_dollar(
prefix = "$",
big.mark = ",",
accuracy = 1
)
) +
scale_x_date(
date_breaks = "2 years",
date_labels = "%Y"
) +
labs(
title = "GrĂ¡fica 9. EvoluciĂ³n del salario promedio mensual por tipo de empleo",
subtitle = "Empleo formal, informal y promedio total en la regiĂ³n Centro, 2015-2026T1",
x = NULL,
y = "Salario promedio mensual",
color = "Tipo de empleo",
caption = paste0(
"Nota: la lĂnea roja representa el salario promedio mensual total reportado por la fuente.Cada panel utiliza una escala vertical independiente.\n Fuente: elaboraciĂ³n propia con datos de la ENOE en Data MĂ©xico (2026)."
)
) +
theme_minimal() +
theme(
legend.position = "bottom",
panel.grid.minor = element_blank(),
strip.text = element_text(
face = "bold"
),
plot.title = element_text(
face = "bold",
hjust = 0.5,
size = 10
),
plot.subtitle = element_text(
hjust = 0.5,
size = 8
),
plot.caption = element_text(
hjust = 0.5,
size = 6,
lineheight = 1.1
),
axis.title.x = element_text(
size = 10
),
axis.text.x = element_text(
size = 9
),
axis.text.y = element_text(
size = 9
)
)
grafica_salarios

GrĂ¡fica 10. Brecha entre crecimiento econĂ³mico y calidad
laboral
pibe <- read_excel("db_1_dinamica.xlsx",sheet = "PIBE")
salario_total <- read_excel("db_2_dinamica.xlsx",sheet = "Salario Total")
informalidad <- read_excel("db_2_dinamica.xlsx", sheet = "Tasa de informalidad")
crecimiento_pibe <- pibe %>%
select(
Año,
starts_with("T_PIB_")
) %>%
pivot_longer(
cols = starts_with("T_PIB_"),
names_to = "Entidad",
values_to = "Crecimiento_PIBE"
) %>%
mutate(
Entidad = str_remove(Entidad, "T_PIB_"),
Año_num = as.numeric(Año)
) %>%
select(Año_num, Entidad, Crecimiento_PIBE)
salario_anual <- salario_total %>%
pivot_longer(
cols = starts_with("SALM_T_"),
names_to = "Entidad",
values_to = "Salario_promedio"
) %>%
mutate(
Entidad = str_remove(Entidad, "SALM_T_"),
Año_num = as.numeric(str_sub(Año, 1, 4))
) %>%
group_by(Año_num, Entidad) %>%
summarise(
Salario_promedio = mean(Salario_promedio, na.rm = TRUE),
.groups = "drop"
)
informalidad_anual <- informalidad %>%
pivot_longer(
cols = starts_with("T_INFORMAL_"),
names_to = "Entidad",
values_to = "Tasa_informalidad"
) %>%
mutate(
Entidad = str_remove(Entidad, "T_INFORMAL_"),
Año_num = as.numeric(str_sub(Año, 1, 4))
) %>%
group_by(Año_num, Entidad) %>%
summarise(
Tasa_informalidad = mean(Tasa_informalidad, na.rm = TRUE),
.groups = "drop"
)
base_crecimiento_calidad <- crecimiento_pibe %>%
left_join(
salario_anual,
by = c("Año_num", "Entidad")
) %>%
left_join(
informalidad_anual,
by = c("Año_num", "Entidad")
) %>%
filter(
!is.na(Crecimiento_PIBE),
!is.na(Salario_promedio),
!is.na(Tasa_informalidad)
)
base_2024 <- base_crecimiento_calidad %>%
filter(Año_num == 2024)
grafica_crecimiento_calidad = ggplot(
base_2024,
aes(
x = Crecimiento_PIBE,
y = Salario_promedio,
color = Tasa_informalidad
)
) +
geom_point(size = 5) +
geom_text_repel(
aes(label = Entidad),
color = "black",
size = 2.8,
max.overlaps = Inf,
box.padding = 0.4,
point.padding = 0.3,
segment.color = "gray60",
segment.linewidth = 0.3
) +
geom_vline(
xintercept = 0,
linetype = "dashed",
color = "gray50"
) +
scale_y_continuous(
labels = label_dollar(
prefix = "$",
big.mark = ",",
accuracy = 1
)
) +
scale_x_continuous(
labels = label_percent(
scale = 1,
accuracy = 0.1
)
) +
scale_color_gradientn(
colors = c(
"#0353a4",
"#0077b6",
"#5b4b9e",
"#b7a9e0"
),
labels = label_percent(scale = 1)
) +
labs(
title = "GrĂ¡fica 10. Crecimiento econĂ³mico y calidad laboral",
subtitle = "Crecimiento del PIBE, salario mensual promedio e informalidad laboral, 2024",
x = "Tasa de crecimiento del PIBE",
y = "Salario mensual promedio",
color = "Tasa de informalidad",
caption = "Nota: la calidad laboral se aproximĂ³ mediante salario promedio e informalidad laboral.\nFuente: elaboraciĂ³n propia con datos del PIBE (INEGI, 2026), Data MĂ©xico (2026) y MĂ©xico, ¿CĂ³mo vamos? (2026)."
) +
theme_minimal() +
theme(
legend.position = "right",
panel.grid.minor = element_blank(),
plot.title = element_text(face = "bold", size = 12, hjust = 0.3),
plot.subtitle = element_text(size = 10, hjust = 0.3),
plot.caption = element_text(size = 7.5, hjust = 0.5),
axis.title = element_text(size = 10),
axis.text = element_text(size = 9),
legend.title = element_text(size = 10),
legend.text = element_text(size = 9),
plot.margin = margin(10, 25, 10, 10)
)
## Warning in geom_text_repel(aes(label = Entidad), color = "black", size = 2.8, :
## Ignoring unknown parameters: `segment.linewidth`
grafica_crecimiento_calidad

Apartado 3.7
GrĂ¡fica 12. IED recibida por entidad
ied <- read_excel("db_3_dinamica.xlsx",sheet = "IED")
paleta_colores <- c(
"CDMX" = "#061a40",
"EDOMEX" = "#0353a4",
"HIDALGO" = "#0077b6",
"MORELOS" = "#5b4b9e",
"PUEBLA" = "#b7a9e0",
"TLAXCALA" = "#9aafd1"
)
ied_larga <- ied %>%
pivot_longer(
cols = starts_with("IED_"),
names_to = "Entidad",
values_to = "IED"
) %>%
mutate(
Entidad = str_remove(Entidad, "IED_"),
IED_mdd = IED / 1000000
)
grafica_ied_estado <- ggplot(
ied_larga,
aes(
x = Año,
y = IED_mdd,
color = Entidad,
group = Entidad
)
) +
geom_line(
linewidth = 0.5
) +
geom_point(
size = 2
) +
scale_color_manual(
values = paleta_colores,
labels = c(
"CDMX" = "CDMX",
"EDOMEX" = "Estado de México",
"HIDALGO" = "Hidalgo",
"MORELOS" = "Morelos",
"PUEBLA" = "Puebla",
"TLAXCALA" = "Tlaxcala"
)
) +
scale_x_continuous(
breaks = seq(2015, 2024, 1)
) +
scale_y_continuous(
labels = label_number(
big.mark = ",",
accuracy = 1
)
) +
labs(
title = "GrĂ¡fica 12. InversiĂ³n extranjera directa recibida por entidad",
subtitle = "IED anual de las entidades de la regiĂ³n Centro, 2015-2024",
x = "Año",
y = "Millones de dĂ³lares",
color = "Entidad",
caption = "Fuente: SecretarĂa de EconomĂa en Data MĂ©xico (2026).ElaboraciĂ³n propia."
) +
theme_minimal() +
theme(
legend.position = "bottom",
panel.grid.minor = element_blank(),
plot.title = element_text(
face = "bold",
size = 12,
hjust = 0.5
),
plot.subtitle = element_text(
size = 10,
hjust = 0.5
),
plot.caption = element_text(
size = 7.5,
hjust = 0.5
),
axis.title = element_text(size = 10),
axis.text = element_text(size = 9),
legend.title = element_text(size = 10),
legend.text = element_text(size = 9),
plot.margin = margin(10, 20, 10, 10)
)
grafica_ied_estado

Anexo 4. ParticipaciĂ³n por entidad en la IED regional
ied_participacion_2024 <- ied_larga %>%
filter(Año == 2024) %>%
group_by(Entidad) %>%
summarise(
IED_mdd = sum(IED_mdd, na.rm = TRUE),
.groups = "drop"
) %>%
mutate(
Participacion = IED_mdd / sum(IED_mdd) * 100
) %>%
arrange(desc(Participacion)) %>%
mutate(
Etiqueta = paste0(
round(Participacion, 1),
"%"
),
inicio = lag(
cumsum(Participacion) / 100 * 2 * pi,
default = 0
),
fin = cumsum(Participacion) / 100 * 2 * pi,
angulo_medio = (inicio + fin) / 2,
x_origen = 0.88 * sin(angulo_medio),
y_origen = 0.88 * cos(angulo_medio),
x_etiqueta = case_when(
Entidad == "CDMX" ~ 1.30,
Entidad == "EDOMEX" ~ -1.30,
Entidad == "PUEBLA" ~ -1.30,
Entidad == "HIDALGO" ~ -1.30,
Entidad == "MORELOS" ~ 1.30,
Entidad == "TLAXCALA" ~ 1.30
),
y_etiqueta = case_when(
Entidad == "CDMX" ~ -0.70,
Entidad == "EDOMEX" ~ -0.10,
Entidad == "PUEBLA" ~ 0.55,
Entidad == "HIDALGO" ~ 0.90,
Entidad == "MORELOS" ~ 0.90,
Entidad == "TLAXCALA" ~ 0.55
),
alineacion = if_else(
x_etiqueta > 0,
0,
1
)
)
grafica_participacion_ied <- ggplot(
ied_participacion_2024
) +
ggforce::geom_arc_bar(
aes(
x0 = 0,
y0 = 0,
r0 = 0,
r = 1,
start = inicio,
end = fin,
fill = Entidad
),
color = NA
) +
geom_segment(
aes(
x = x_origen,
y = y_origen,
xend = x_etiqueta,
yend = y_etiqueta
),
color = "gray55",
linewidth = 0.4
) +
geom_label(
aes(
x = x_etiqueta,
y = y_etiqueta,
label = Etiqueta,
hjust = alineacion
),
size = 3,
color = "black",
fill = "white",
label.size = 0.25,
label.padding = unit(0.18, "lines")
) +
scale_fill_manual(
values = paleta_colores,
breaks = c(
"CDMX",
"EDOMEX",
"HIDALGO",
"MORELOS",
"PUEBLA",
"TLAXCALA"
),
labels = c(
"CDMX",
"Estado de México",
"Hidalgo",
"Morelos",
"Puebla",
"Tlaxcala"
)
) +
coord_fixed(
xlim = c(-1.65, 1.65),
ylim = c(-1.20, 1.25),
clip = "off"
) +
labs(
title = "ParticipaciĂ³n estatal en la inversiĂ³n extranjera directa regional, 2024",
fill = "Entidad",
caption = "Nota: la participaciĂ³n se calculĂ³ respecto a la suma de la IED recibida por las seis entidades.\nFuente: SecretarĂa de EconomĂa en Data MĂ©xico (2026)."
) +
theme_void() +
theme(
legend.position = "bottom",
legend.title = element_text(
size = 10
),
legend.text = element_text(
size = 9
),
plot.title = element_text(
face = "bold",
size = 12,
hjust = 0.5
),
plot.subtitle = element_text(
size = 10,
hjust = 0.5
),
plot.caption = element_text(
size = 7.5,
hjust = 0.5
),
plot.margin = margin(
10,
35,
10,
35
)
)
## Warning: The `label.size` argument of `geom_label()` is deprecated as of ggplot2 3.5.0.
## ℹ Please use the `linewidth` argument instead.
## This warning is displayed once per session.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.
grafica_participacion_ied

Anexo 5. ComposiciĂ³n de la IED por entidad
componentes_ied <- read_excel(
"db_3_dinamica.xlsx",
sheet = "Componentes_IED",
col_names = FALSE
)
## New names:
## • `` -> `...1`
## • `` -> `...2`
## • `` -> `...3`
## • `` -> `...4`
## • `` -> `...5`
## • `` -> `...6`
## • `` -> `...7`
## • `` -> `...8`
## • `` -> `...9`
## • `` -> `...10`
## • `` -> `...11`
## • `` -> `...12`
## • `` -> `...13`
## • `` -> `...14`
## • `` -> `...15`
## • `` -> `...16`
## • `` -> `...17`
## • `` -> `...18`
## • `` -> `...19`
## • `` -> `...20`
## • `` -> `...21`
## • `` -> `...22`
## • `` -> `...23`
## • `` -> `...24`
## • `` -> `...25`
## • `` -> `...26`
## • `` -> `...27`
## • `` -> `...28`
## • `` -> `...29`
## • `` -> `...30`
## • `` -> `...31`
## • `` -> `...32`
## • `` -> `...33`
## • `` -> `...34`
## • `` -> `...35`
## • `` -> `...36`
## • `` -> `...37`
## • `` -> `...38`
## • `` -> `...39`
## • `` -> `...40`
## • `` -> `...41`
## • `` -> `...42`
## • `` -> `...43`
## • `` -> `...44`
## • `` -> `...45`
componentes_2025 <- componentes_ied %>%
select(
Concepto = 1,
Valor = 45
) %>%
mutate(
Entidad = case_when(
Concepto == "Ciudad de México" ~ "CDMX",
Concepto == "Estado de México" ~ "EDOMEX",
Concepto == "Hidalgo" ~ "HIDALGO",
Concepto == "Morelos" ~ "MORELOS",
Concepto == "Puebla" ~ "PUEBLA",
Concepto == "Tlaxcala" ~ "TLAXCALA",
TRUE ~ NA_character_
)
) %>%
fill(Entidad) %>%
filter(
Concepto %in% c(
"Nuevas inversiones",
"ReinversiĂ³n de utilidades",
"Cuentas entre compañĂas"
)
) %>%
mutate(
Valor = na_if(as.character(Valor), "C"),
IED_mdd = as.numeric(Valor),
Componente = Concepto,
Entidad = factor(
Entidad,
levels = c(
"CDMX",
"EDOMEX",
"HIDALGO",
"MORELOS",
"PUEBLA",
"TLAXCALA"
)
),
Componente = factor(
Componente,
levels = c(
"Nuevas inversiones",
"ReinversiĂ³n de utilidades",
"Cuentas entre compañĂas"
)
)
)
paleta_componentes <- c(
"Nuevas inversiones" = "#061a40",
"ReinversiĂ³n de utilidades" = "#0077b6",
"Cuentas entre compañĂas" = "#b7a9e0"
)
grafica_componentes_2025 <- ggplot(
componentes_2025,
aes(
x = Componente,
y = IED_mdd,
fill = Componente
)
) +
geom_hline(
yintercept = 0,
color = "gray50",
linewidth = 0.4
) +
geom_col(
width = 0.65,
show.legend = FALSE
) +
geom_text(
aes(
label = case_when(
is.na(IED_mdd) ~ "C",
TRUE ~ label_number(
big.mark = ",",
accuracy = 0.1
)(IED_mdd)
)
),
vjust = ifelse(
componentes_2025$IED_mdd >= 0,
-0.4,
1.3
),
size = 2.7,
color = "black"
) +
facet_wrap(
~Entidad,
scales = "free_y",
ncol = 2,
labeller = as_labeller(
c(
"CDMX" = "CDMX",
"EDOMEX" = "Estado de México",
"HIDALGO" = "Hidalgo",
"MORELOS" = "Morelos",
"PUEBLA" = "Puebla",
"TLAXCALA" = "Tlaxcala"
)
)
) +
scale_x_discrete(
labels = c(
"Nuevas inversiones" = "Nuevas\ninversiones",
"ReinversiĂ³n de utilidades" = "ReinversiĂ³n\nde utilidades",
"Cuentas entre compañĂas" = "Cuentas entre\ncompañĂas"
)
) +
scale_y_continuous(
labels = label_number(
big.mark = ",",
accuracy = 1
),
expand = expansion(
mult = c(0.15, 0.20)
)
) +
scale_fill_manual(
values = paleta_componentes
) +
labs(
title = "ComposiciĂ³n de la inversiĂ³n extranjera directa por entidad",
subtitle = "Cierre de 2025",
x = NULL,
y = "Millones de dĂ³lares corrientes",
caption = "Nota: cada panel utiliza una escala vertical independiente. Se emplea la IED acumulada al cuarto trimestre de 2025. \nLa letra C corresponde a informaciĂ³n confidencial y se tratĂ³ como dato no disponible. \nLos valores negativos representan desinversiĂ³n neta.\nFuente: SecretarĂa de EconomĂa (2026)."
) +
theme_minimal() +
theme(
panel.grid.minor = element_blank(),
panel.grid.major.x = element_blank(),
plot.title = element_text(
face = "bold",
size = 12,
hjust = 0.5
),
plot.subtitle = element_text(
size = 10,
hjust = 0.5
),
plot.caption = element_text(
size = 7.5,
hjust = 0.5,
lineheight = 1.1
),
axis.title = element_text(
size = 10
),
axis.text.x = element_text(
size = 7.5,
color = "black"
),
axis.text.y = element_text(
size = 8
),
strip.text = element_text(
face = "bold",
size = 10
),
plot.margin = margin(
10,
20,
10,
10
)
)
grafica_componentes_2025
## Warning: Removed 1 row containing missing values or values outside the scale range
## (`geom_col()`).
## Warning: Removed 1 row containing missing values or values outside the scale range
## (`geom_text()`).

GrĂ¡fica 13. Principales paĂses de origen de la IED con mayor
aportaciĂ³n neta positiva
ied_origen_cdmx <- read_excel(
"db_3_dinamica.xlsx",
sheet = "IED_O_CDMX"
) %>%
mutate(Entidad = "CDMX")
ied_origen_edomex <- read_excel(
"db_3_dinamica.xlsx",
sheet = "IED_O_EDOMEX"
) %>%
mutate(Entidad = "EDOMEX")
ied_origen_hidalgo <- read_excel(
"db_3_dinamica.xlsx",
sheet = "IED_O_HIDALGO"
) %>%
mutate(Entidad = "HIDALGO")
ied_origen_morelos <- read_excel(
"db_3_dinamica.xlsx",
sheet = "IED_O_MORELOS"
) %>%
mutate(Entidad = "MORELOS")
ied_origen_puebla <- read_excel(
"db_3_dinamica.xlsx",
sheet = "IED_O_PUEBLA"
) %>%
mutate(Entidad = "PUEBLA")
ied_origen_tlaxcala <- read_excel(
"db_3_dinamica.xlsx",
sheet = "IED_O_TLAXCALA"
) %>%
mutate(Entidad = "TLAXCALA")
ied_origen <- bind_rows(
ied_origen_cdmx,
ied_origen_edomex,
ied_origen_hidalgo,
ied_origen_morelos,
ied_origen_puebla,
ied_origen_tlaxcala
)
principales_paises_ied <- ied_origen %>%
filter(
Año >= 2019,
Año <= 2024
) %>%
group_by(
Entidad,
PaĂs
) %>%
summarise(
IED_mdd = sum(IED, na.rm = TRUE) / 1000000,
.groups = "drop"
) %>%
filter(IED_mdd > 0) %>%
group_by(Entidad) %>%
slice_max(
order_by = IED_mdd,
n = 5,
with_ties = FALSE
) %>%
ungroup() %>%
mutate(
Entidad = factor(
Entidad,
levels = c(
"CDMX",
"EDOMEX",
"HIDALGO",
"MORELOS",
"PUEBLA",
"TLAXCALA"
)
),
Pais_Entidad = paste(
PaĂs,
Entidad,
sep = "___"
),
Pais_Entidad = reorder(
Pais_Entidad,
IED_mdd
)
)
grafica_paises_ied <- ggplot(
principales_paises_ied,
aes(
x = IED_mdd,
y = Pais_Entidad,
fill = Entidad
)
) +
geom_col(
width = 0.7,
show.legend = FALSE
) +
geom_text(
aes(
label = label_number(
big.mark = ",",
accuracy = 0.1
)(IED_mdd)
),
hjust = -0.1,
color = "black",
size = 2.7
) +
facet_wrap(
~Entidad,
scales = "free",
ncol = 2,
labeller = as_labeller(
c(
"CDMX" = "CDMX",
"EDOMEX" = "Estado de México",
"HIDALGO" = "Hidalgo",
"MORELOS" = "Morelos",
"PUEBLA" = "Puebla",
"TLAXCALA" = "Tlaxcala"
)
)
) +
scale_y_discrete(
labels = function(x) {
etiquetas <- str_remove(
x,
"___(CDMX|EDOMEX|HIDALGO|MORELOS|PUEBLA|TLAXCALA)$"
)
str_wrap(
etiquetas,
width = 22
)
}
) +
scale_x_continuous(
labels = label_number(
big.mark = ",",
accuracy = 1
),
expand = expansion(
mult = c(0, 0.25)
)
) +
scale_fill_manual(
values = paleta_colores
) +
labs(
title = "GrĂ¡fica 13. Principales paĂses de origen de la IED con mayor aportaciĂ³n neta positiva",
subtitle = "IED acumulada de 2019 a 2024",
x = "Millones de dĂ³lares",
y = NULL,
caption = paste0(
"Nota: se presentan los cinco paĂses con mayor IED acumulada positiva en cada entidad durante 2019-2024.\nLos saldos negativos fueron excluidos. Fuente: SecretarĂa de EconomĂa en Data MĂ©xico (2026)."
)
) +
theme_minimal() +
theme(
legend.position = "none",
panel.grid.minor = element_blank(),
panel.grid.major.y = element_blank(),
plot.title = element_text(
face = "bold",
size = 10,
hjust = 0.5
),
plot.subtitle = element_text(
size = 8,
hjust = 0.5
),
plot.caption = element_text(
size = 7.5,
hjust = 0.5,
lineheight = 1.1
),
axis.title = element_text(
size = 10
),
axis.text.x = element_text(
size = 8
),
axis.text.y = element_text(
size = 7
),
strip.text = element_text(
face = "bold",
size = 9
),
plot.margin = margin(
10,
35,
10,
10
)
)
grafica_paises_ied

GrĂ¡fica 11. Brecha entre atracciĂ³n de inversiĂ³n y calidad del
empleo
# ------------------------------------------------
# 1. Leer bases
# ------------------------------------------------
ied <- read_excel(
"db_3_dinamica.xlsx",
sheet = "IED"
)
pibe_corriente <- read_excel(
"db_3_dinamica.xlsx",
sheet = "PIBE Corriente"
)
salario_total <- read_excel(
"db_2_dinamica.xlsx",
sheet = "Salario Total"
)
informalidad <- read_excel(
"db_2_dinamica.xlsx",
sheet = "Tasa de informalidad"
)
# ------------------------------------------------
# 2. Preparar IED 2024
# ------------------------------------------------
ied_2024 <- ied %>%
pivot_longer(
cols = starts_with("IED_"),
names_to = "Entidad",
values_to = "IED_dolares"
) %>%
mutate(
Entidad = str_remove(Entidad, "IED_"),
Año = as.numeric(Año),
IED_mdd = IED_dolares / 1000000
) %>%
filter(Año == 2024) %>%
select(
Año,
Entidad,
IED_mdd
)
# ------------------------------------------------
# 3. Preparar PIBE corriente 2024
# ------------------------------------------------
pibe_2024 <- pibe_corriente %>%
pivot_longer(
cols = starts_with("PIBE_C_"),
names_to = "Entidad",
values_to = "PIBE_corriente"
) %>%
mutate(
Entidad = str_remove(Entidad, "PIBE_C_"),
Año = as.numeric(Año)
) %>%
filter(Año == 2024) %>%
select(
Año,
Entidad,
PIBE_corriente
)
# ------------------------------------------------
# 4. Calcular IED como porcentaje del PIBE
# ------------------------------------------------
tipo_cambio_2024 <- 18.333575
base_ied_pibe_2024 <- ied_2024 %>%
left_join(
pibe_2024,
by = c("Año", "Entidad")
) %>%
mutate(
IED_mdp = IED_mdd * tipo_cambio_2024,
IED_PIBE = IED_mdp / PIBE_corriente * 100
)
# ------------------------------------------------
# 5. Preparar salario promedio 2024
# ------------------------------------------------
salario_2024 <- salario_total %>%
pivot_longer(
cols = starts_with("SALM_T_"),
names_to = "Entidad",
values_to = "Salario_promedio"
) %>%
mutate(
Entidad = str_remove(Entidad, "SALM_T_"),
Año_num = as.numeric(str_sub(as.character(Año), 1, 4))
) %>%
filter(Año_num == 2024) %>%
group_by(Entidad) %>%
summarise(
Salario_promedio = mean(
Salario_promedio,
na.rm = TRUE
),
.groups = "drop"
)
# ------------------------------------------------
# 6. Preparar informalidad 2024
# ------------------------------------------------
informalidad_2024 <- informalidad %>%
pivot_longer(
cols = starts_with("T_INFORMAL_"),
names_to = "Entidad",
values_to = "Tasa_informalidad"
) %>%
mutate(
Entidad = str_remove(Entidad, "T_INFORMAL_"),
Año_num = as.numeric(str_sub(as.character(Año), 1, 4))
) %>%
filter(Año_num == 2024) %>%
group_by(Entidad) %>%
summarise(
Tasa_informalidad = mean(
Tasa_informalidad,
na.rm = TRUE
),
.groups = "drop"
)
# ------------------------------------------------
# 7. Unir todas las variables
# ------------------------------------------------
base_brecha_ied_empleo <- base_ied_pibe_2024 %>%
left_join(
salario_2024,
by = "Entidad"
) %>%
left_join(
informalidad_2024,
by = "Entidad"
) %>%
filter(
!is.na(IED_PIBE),
!is.na(Salario_promedio),
!is.na(Tasa_informalidad)
) %>%
mutate(
Entidad_nombre = recode(
Entidad,
"CDMX" = "CDMX",
"EDOMEX" = "Estado de México",
"HIDALGO" = "Hidalgo",
"MORELOS" = "Morelos",
"PUEBLA" = "Puebla",
"TLAXCALA" = "Tlaxcala"
)
)
# ------------------------------------------------
# 8. GrĂ¡fica
# ------------------------------------------------
grafica_brecha_ied_empleo <- ggplot(
base_brecha_ied_empleo,
aes(
x = IED_PIBE,
y = Salario_promedio,
color = Tasa_informalidad
)
) +
geom_point(
size = 5
) +
geom_text_repel(
aes(label = Entidad_nombre),
color = "black",
size = 2.8,
max.overlaps = Inf,
box.padding = 0.5,
point.padding = 0.35,
segment.color = "gray60",
segment.linewidth = 0.3,
min.segment.length = 0,
seed = 123
) +
scale_x_continuous(
labels = label_percent(
scale = 1,
accuracy = 0.1
)
) +
scale_y_continuous(
labels = label_dollar(
prefix = "$",
big.mark = ",",
accuracy = 1
)
) +
scale_color_gradientn(
colors = c(
"#0353a4",
"#0077b6",
"#5b4b9e",
"#b7a9e0"
),
labels = label_percent(
scale = 1,
accuracy = 1
)
) +
labs(
title = "GrĂ¡fica 11. AtracciĂ³n de inversiĂ³n y calidad del empleo",
subtitle = "IED como porcentaje del PIBE, salario mensual promedio e informalidad laboral, 2024",
x = "IED como porcentaje del PIBE",
y = "Salario mensual promedio",
color = "Tasa de informalidad",
caption = paste0(
"Nota: la IED de 2024 se convirtiĂ³ a pesos con un tipo de cambio promedio anual de 18.333575 pesos por dĂ³lar. \nSe usaron salario promedio y tasa de informalidad como proxys a la calidad laboral.Fuente: elaboraciĂ³n propia con datos de la \nSecretarĂa de EconomĂa en Data MĂ©xico (2026), INEGI (2026), MĂ©xico, ¿CĂ³mo vamos? (2026) y Banco de MĂ©xico (2026)."
)
) +
theme_minimal() +
theme(
legend.position = "right",
panel.grid.minor = element_blank(),
plot.title = element_text(
face = "bold",
size = 12,
hjust = 0.5
),
plot.subtitle = element_text(
size = 10,
hjust = 0.5
),
plot.caption = element_text(
size = 7.5,
hjust = 0.2,
lineheight = 1.1
),
axis.title = element_text(size = 10),
axis.text = element_text(size = 9),
legend.title = element_text(size = 10),
legend.text = element_text(size = 9),
plot.margin = margin(10, 30, 10, 10)
)
## Warning in geom_text_repel(aes(label = Entidad_nombre), color = "black", :
## Ignoring unknown parameters: `segment.linewidth`
grafica_brecha_ied_empleo

Exportaciones
GrĂ¡fica 15. ParticipaciĂ³n estatal en las exportaciones
regionales
exportaciones = read_excel("db_3_dinamica.xlsx", sheet = "Exportaciones")
exportaciones_anuales = exportaciones %>%
pivot_longer(
cols = starts_with("EXPORTS_"),
names_to = "Entidad",
values_to = "Exportaciones_dolares"
) %>%
mutate(
Entidad = str_remove(Entidad, "EXPORTS_"),
Año_num = as.numeric(str_sub(as.character(Año), 1, 4))
) %>%
filter(Año_num >= 2015, Año_num <= 2025) %>%
group_by(Año_num, Entidad) %>%
summarise(
Exportaciones_mdd = sum(Exportaciones_dolares, na.rm = TRUE) / 1000000,
.groups = "drop"
)
participacion_exportaciones_2024 = exportaciones_anuales %>%
filter(Año_num == 2024) %>%
mutate(
Participacion = Exportaciones_mdd / sum(Exportaciones_mdd, na.rm = TRUE) * 100,
Entidad_nombre = recode(
as.character(Entidad),
"CDMX" = "CDMX",
"EDOMEX" = "Estado de México",
"HIDALGO" = "Hidalgo",
"MORELOS" = "Morelos",
"PUEBLA" = "Puebla",
"TLAXCALA" = "Tlaxcala"
),
Entidad_nombre = reorder(Entidad_nombre, Participacion)
)
grafica_participacion_exportaciones = ggplot(
participacion_exportaciones_2024,
aes(x = Participacion, y = Entidad_nombre, fill = Entidad)
) +
geom_col(width = 0.7, show.legend = FALSE) +
geom_text(
aes(label = paste0(label_number(accuracy = 0.1, decimal.mark = ".")(Participacion), "%")),
hjust = -0.15,
color = "black",
size = 3.2
) +
scale_fill_manual(values = paleta_colores) +
scale_x_continuous(
labels = label_percent(scale = 1, accuracy = 1),
expand = expansion(mult = c(0, 0.15))
) +
labs(
title = "GrĂ¡fica 15. ParticipaciĂ³n estatal en las exportaciones regionales",
subtitle = "ParticipaciĂ³n porcentual en el valor exportado por la regiĂ³n Centro, 2024",
x = NULL,
y = NULL,
caption = paste0(
"Nota: la participaciĂ³n se calculĂ³ respecto a la suma de las ",
"exportaciones de las seis entidades durante 2024.\n",
"Fuente: SecretarĂa de EconomĂa en Data MĂ©xico (2026). ElaboraciĂ³n propia."
)
) +
theme_minimal() +
theme(
legend.position = "none",
panel.grid.minor = element_blank(),
panel.grid.major.y = element_blank(),
plot.title = element_text(face = "bold", size = 12, hjust = 0.5),
plot.subtitle = element_text(size = 10, hjust = 0.5),
plot.caption = element_text(size = 7.5, hjust = 0.5, lineheight = 1.1),
axis.title = element_text(size = 10),
axis.text.x = element_text(size = 9),
axis.text.y = element_text(size = 9, color = "black"),
plot.margin = margin(10, 30, 10, 10)
)
grafica_participacion_exportaciones

Anexo 6. ComposiciĂ³n de las exportaciones por entidad
# ------------------------------------------------
# 1. Leer y unir las bases
# ------------------------------------------------
productos_exportados <- bind_rows(
read_excel(
"db_3_dinamica.xlsx",
sheet = "EXPORTS_24_CDMX"
) %>%
mutate(Entidad = "CDMX"),
read_excel(
"db_3_dinamica.xlsx",
sheet = "EXPORTS_24_EDOMEX"
) %>%
mutate(Entidad = "EDOMEX"),
read_excel(
"db_3_dinamica.xlsx",
sheet = "EXPORTS_24_HIDALGO"
) %>%
mutate(Entidad = "HIDALGO"),
read_excel(
"db_3_dinamica.xlsx",
sheet = "EXPORTS_24_MORELOS"
) %>%
mutate(Entidad = "MORELOS"),
read_excel(
"db_3_dinamica.xlsx",
sheet = "EXPORTS_24_PUEBLA"
) %>%
mutate(Entidad = "PUEBLA"),
read_excel(
"db_3_dinamica.xlsx",
sheet = "EXPORTS_24_TLAXCALA"
) %>%
mutate(Entidad = "TLAXCALA")
)
exportaciones_sector <- productos_exportados %>%
transmute(
Entidad,
Sector = as.character(Digit),
Exportaciones_dolares = as.numeric(`Trade Value`)
) %>%
filter(
!is.na(Entidad),
!is.na(Sector),
!is.na(Exportaciones_dolares),
Exportaciones_dolares > 0
) %>%
group_by(
Entidad,
Sector
) %>%
summarise(
Exportaciones_dolares = sum(
Exportaciones_dolares,
na.rm = TRUE
),
.groups = "drop"
)
top10_sectores <- exportaciones_sector %>%
group_by(Entidad) %>%
slice_max(
order_by = Exportaciones_dolares,
n = 10,
with_ties = FALSE
) %>%
ungroup() %>%
select(
Entidad,
Sector
) %>%
mutate(Top10 = TRUE)
composicion_treemap <- exportaciones_sector %>%
left_join(
top10_sectores,
by = c(
"Entidad",
"Sector"
)
) %>%
mutate(
Sector_grafica = if_else(
is.na(Top10),
"Otros sectores",
Sector
)
) %>%
group_by(
Entidad,
Sector_grafica
) %>%
summarise(
Exportaciones_dolares = sum(
Exportaciones_dolares,
na.rm = TRUE
),
.groups = "drop"
) %>%
group_by(Entidad) %>%
mutate(
Participacion = Exportaciones_dolares /
sum(Exportaciones_dolares, na.rm = TRUE) * 100,
Etiqueta = paste0(
str_wrap(
Sector_grafica,
width = 20
),
"\n",
number(
Participacion,
accuracy = 0.1,
decimal.mark = "."
),
"%"
)
) %>%
ungroup() %>%
mutate(
Entidad = factor(
Entidad,
levels = c(
"CDMX",
"EDOMEX",
"HIDALGO",
"MORELOS",
"PUEBLA",
"TLAXCALA"
)
)
)
paleta_colores <- c(
"CDMX" = "#061a40",
"EDOMEX" = "#0353a4",
"HIDALGO" = "#0077b6",
"MORELOS" = "#5b4b9e",
"PUEBLA" = "#b7a9e0",
"TLAXCALA" = "#9aafd1"
)
grafica_treemap_entidades <- ggplot(
composicion_treemap,
aes(
area = Exportaciones_dolares,
fill = Entidad,
label = Etiqueta
)
) +
geom_treemap(
color = "white",
linewidth = 1
) +
geom_treemap_text(
color = "white",
place = "centre",
grow = FALSE,
reflow = TRUE,
min.size = 4.5,
fontface = "bold"
) +
facet_wrap(
~Entidad,
ncol = 2,
labeller = as_labeller(
c(
"CDMX" = "CDMX",
"EDOMEX" = "Estado de México",
"HIDALGO" = "Hidalgo",
"MORELOS" = "Morelos",
"PUEBLA" = "Puebla",
"TLAXCALA" = "Tlaxcala"
)
)
) +
scale_fill_manual(
values = paleta_colores
) +
labs(
title = "ComposiciĂ³n de las exportaciones por entidad",
subtitle = "Diez principales sectores exportadores y participaciĂ³n porcentual, 2024",
caption = paste0(
"Nota: el tamaño de cada caja representa la participaciĂ³n del sector en las exportaciones totales de la entidad.\nLos sectores fuera del top 10 se agrupan en Otros sectores. Fuente: SecretarĂa de EconomĂa en Data MĂ©xico (2026).ElaboraciĂ³n propia"
)
) +
theme_void() +
theme(
legend.position = "none",
strip.text = element_text(
face = "bold",
size = 10,
color = "black",
margin = margin(
b = 5
)
),
panel.spacing = unit(
0.8,
"lines"
),
plot.title = element_text(
face = "bold",
size = 12,
hjust = 0.5
),
plot.subtitle = element_text(
size = 10,
hjust = 0.5
),
plot.caption = element_text(
size = 7,
hjust = 0.5,
lineheight = 1.1
),
plot.margin = margin(
10,
15,
10,
15
)
)
## Warning in geom_treemap(color = "white", linewidth = 1): Ignoring unknown
## parameters: `linewidth`
grafica_treemap_entidades

Anexo 7. Principales destinos de exportaciĂ³n por entidad
# ------------------------------------------------
# 1. Leer y unir las pestañas de destinos
# ------------------------------------------------
destinos_exportacion <- bind_rows(
read_excel(
"db_3_dinamica.xlsx",
sheet = "DEST_2024_CDMX"
) %>%
mutate(Entidad = "CDMX"),
read_excel(
"db_3_dinamica.xlsx",
sheet = "DEST_2024_EDOMEX"
) %>%
mutate(Entidad = "EDOMEX"),
read_excel(
"db_3_dinamica.xlsx",
sheet = "DEST_2024_HIDALGO"
) %>%
mutate(Entidad = "HIDALGO"),
read_excel(
"db_3_dinamica.xlsx",
sheet = "DEST_2024_MORELOS"
) %>%
mutate(Entidad = "MORELOS"),
read_excel(
"db_3_dinamica.xlsx",
sheet = "DEST_2024_PUEBLA"
) %>%
mutate(Entidad = "PUEBLA"),
read_excel(
"db_3_dinamica.xlsx",
sheet = "DEST_2024_TLAXCALA"
) %>%
mutate(Entidad = "TLAXCALA")
)
top5_destinos <- destinos_exportacion %>%
transmute(
Entidad,
Pais = as.character(Country),
Exportaciones_dolares = as.numeric(`Trade Value`)
) %>%
filter(
!is.na(Pais),
!is.na(Exportaciones_dolares),
Exportaciones_dolares > 0,
!Pais %in% c(
"World",
"Mundo",
"Total"
)
) %>%
group_by(
Entidad,
Pais
) %>%
summarise(
Exportaciones_dolares = sum(
Exportaciones_dolares,
na.rm = TRUE
),
.groups = "drop"
) %>%
group_by(Entidad) %>%
mutate(
Participacion = Exportaciones_dolares /
sum(Exportaciones_dolares, na.rm = TRUE) * 100
) %>%
slice_max(
order_by = Exportaciones_dolares,
n = 5,
with_ties = FALSE
) %>%
ungroup() %>%
mutate(
Entidad = factor(
Entidad,
levels = c(
"CDMX",
"EDOMEX",
"HIDALGO",
"MORELOS",
"PUEBLA",
"TLAXCALA"
)
),
Pais_Entidad = paste(
Pais,
Entidad,
sep = "___"
),
Pais_Entidad = reorder(
Pais_Entidad,
Participacion
)
)
paleta_colores <- c(
"CDMX" = "#061a40",
"EDOMEX" = "#0353a4",
"HIDALGO" = "#0077b6",
"MORELOS" = "#5b4b9e",
"PUEBLA" = "#b7a9e0",
"TLAXCALA" = "#9aafd1"
)
grafica_destinos_exportacion <- ggplot(
top5_destinos,
aes(
x = Participacion,
y = Pais_Entidad,
fill = Entidad
)
) +
geom_col(
width = 0.7,
show.legend = FALSE
) +
geom_text(
aes(
label = paste0(
number(
Participacion,
accuracy = 0.1
),
"%"
)
),
hjust = -0.12,
color = "black",
size = 2.8
) +
facet_wrap(
~Entidad,
scales = "free_y",
ncol = 2,
labeller = as_labeller(
c(
"CDMX" = "CDMX",
"EDOMEX" = "Estado de México",
"HIDALGO" = "Hidalgo",
"MORELOS" = "Morelos",
"PUEBLA" = "Puebla",
"TLAXCALA" = "Tlaxcala"
)
)
) +
scale_y_discrete(
labels = function(x) {
str_remove(
x,
"___(CDMX|EDOMEX|HIDALGO|MORELOS|PUEBLA|TLAXCALA)$"
)
}
) +
scale_x_continuous(
labels = label_percent(
scale = 1,
accuracy = 1
),
expand = expansion(
mult = c(0, 0.18)
)
) +
scale_fill_manual(
values = paleta_colores
) +
labs(
title = "Principales destinos de exportaciĂ³n por entidad",
subtitle = "Cinco principales mercados de destino y participaciĂ³n porcentual, 2024",
x = NULL,
y = NULL,
caption = paste0(
"Nota: la participaciĂ³n se calculĂ³ respecto al valor total exportado por cada entidad. \nSe presentan los cinco principales paĂses de destino. Fuente: SecretarĂa de EconomĂa en Data MĂ©xico (2026). ElaboraciĂ³n propia"
)
) +
theme_minimal() +
theme(
legend.position = "none",
panel.grid.minor = element_blank(),
panel.grid.major.y = element_blank(),
plot.title = element_text(
face = "bold",
size = 12,
hjust = 0.5
),
plot.subtitle = element_text(
size = 10,
hjust = 0.5
),
plot.caption = element_text(
size = 6,
hjust = 0.5,
lineheight = 1.1
),
axis.title = element_text(
size = 10
),
axis.text.x = element_text(
size = 8
),
axis.text.y = element_text(
size = 8,
color = "black"
),
strip.text = element_text(
face = "bold",
size = 9
),
plot.margin = margin(
10,
30,
10,
10
)
)
grafica_destinos_exportacion

GrĂ¡fica 16. Dependencia exportadora a NorteamĂ©rica
dependencia_norteamerica <- destinos_exportacion %>%
transmute(
Entidad,
Pais = str_squish(
as.character(Country)
),
Exportaciones_dolares = as.numeric(
`Trade Value`
)
) %>%
filter(
!is.na(Pais),
!is.na(Exportaciones_dolares),
Exportaciones_dolares > 0,
!Pais %in% c(
"World",
"Mundo",
"Total"
)
) %>%
mutate(
Mercado = case_when(
Pais %in% c(
"United States",
"United States of America",
"Estados Unidos",
"USA",
"US"
) ~ "Estados Unidos",
Pais %in% c(
"Canada",
"CanadĂ¡"
) ~ "CanadĂ¡",
TRUE ~ "Resto del mundo"
)
) %>%
group_by(
Entidad,
Mercado
) %>%
summarise(
Exportaciones_dolares = sum(
Exportaciones_dolares,
na.rm = TRUE
),
.groups = "drop"
) %>%
group_by(Entidad) %>%
mutate(
Participacion = Exportaciones_dolares /
sum(Exportaciones_dolares, na.rm = TRUE) * 100
) %>%
ungroup() %>%
mutate(
Entidad = factor(
Entidad,
levels = c(
"CDMX",
"EDOMEX",
"HIDALGO",
"MORELOS",
"PUEBLA",
"TLAXCALA"
)
),
Mercado = factor(
Mercado,
levels = c(
"Resto del mundo",
"CanadĂ¡",
"Estados Unidos"
)
)
)
participacion_norteamerica <- dependencia_norteamerica %>%
filter(
Mercado %in% c(
"Estados Unidos",
"CanadĂ¡"
)
) %>%
group_by(Entidad) %>%
summarise(
Norteamerica = sum(
Participacion,
na.rm = TRUE
),
.groups = "drop"
)
paleta_mercados <- c(
"Estados Unidos" = "#061a40",
"CanadĂ¡" = "#0077b6",
"Resto del mundo" = "#b7a9e0"
)
grafica_dependencia_norteamerica <- ggplot(
dependencia_norteamerica,
aes(
x = Participacion,
y = Entidad,
fill = Mercado
)
) +
geom_col(
width = 0.68,
color = "white",
linewidth = 0.5
) +
# Porcentajes dentro de cada segmento
geom_text(
aes(
label = if_else(
Participacion >= 4,
paste0(
number(
Participacion,
accuracy = 0.1
),
"%"
),
""
)
),
position = position_stack(
vjust = 0.5
),
color = "white",
fontface = "bold",
size = 3.2
) +
# Porcentaje total destinado a Norteamérica
geom_text(
data = participacion_norteamerica,
aes(
x = 102,
y = Entidad,
label = paste0(
number(
Norteamerica,
accuracy = 0.1
),
"%"
)
),
inherit.aes = FALSE,
hjust = 0,
color = "black",
fontface = "bold",
size = 3.2
) +
scale_y_discrete(
labels = c(
"CDMX" = "CDMX",
"EDOMEX" = "Estado de México",
"HIDALGO" = "Hidalgo",
"MORELOS" = "Morelos",
"PUEBLA" = "Puebla",
"TLAXCALA" = "Tlaxcala"
)
) +
scale_x_continuous(
labels = label_percent(
scale = 1,
accuracy = 1
),
limits = c(0, 113),
breaks = seq(
0,
100,
by = 20
),
expand = expansion(
mult = c(0, 0)
)
) +
scale_fill_manual(
values = paleta_mercados
) +
labs(
title = "GrĂ¡fica 16. Dependencia exportadora a NorteamĂ©rica",
subtitle = "DistribuciĂ³n de las exportaciones estatales segĂºn mercado de destino, 2024",
x = "ParticipaciĂ³n en las exportaciones estatales",
y = NULL,
fill = "Mercado de destino",
caption = paste0(
"Nota: la cifra ubicada a la derecha de cada barra corresponde a la participaciĂ³n conjunta de Estados Unidos y CanadĂ¡. Cada barra suma 100%.\nFuente: SecretarĂa de EconomĂa en Data MĂ©xico (2026). ElaboraciĂ³n propia"
)
) +
annotate(
"text",
x = 102,
y = 6.7,
label = "Norteamérica",
hjust = 0,
fontface = "bold",
size = 3.2
) +
coord_cartesian(
clip = "off"
) +
theme_minimal() +
theme(
legend.position = "bottom",
panel.grid.minor = element_blank(),
panel.grid.major.y = element_blank(),
plot.title = element_text(
face = "bold",
size = 12,
hjust = 0.5
),
plot.subtitle = element_text(
size = 10,
hjust = 0.5
),
plot.caption = element_text(
size = 7.5,
hjust = 0.5,
lineheight = 1.1,
margin = margin(
t = 10
)
),
axis.title = element_text(
size = 10
),
axis.text.x = element_text(
size = 8
),
axis.text.y = element_text(
size = 9,
color = "black"
),
legend.title = element_text(
size = 9
),
legend.text = element_text(
size = 8
),
plot.margin = margin(
15,
65,
15,
15
)
)
grafica_dependencia_norteamerica
