Skip to content

Instantly share code, notes, and snippets.

@sientifiko
Last active April 9, 2021 23:19
Show Gist options
  • Save sientifiko/6412791cf13c635806302e69a96d3dfd to your computer and use it in GitHub Desktop.
Save sientifiko/6412791cf13c635806302e69a96d3dfd to your computer and use it in GitHub Desktop.
library(tidyverse)
library(patchwork)
theme_set(theme_classic())
paises <- c("Argentina", "Bolivia", "Brasil", "Chile", "Colombia",
"Costa Rica", "Cuba", "Ecuador", "El Salvador", "Guatemala", "Honduras",
"México", "Nicaragua", "Panamá", "Paraguay", "Perú", "Rep Dominicana",
"Uruguay", "Venezuela")
p20_1970 <- c(.044, .04, .032, .044, .035, .03, .078,.029, NA, .05,.023, .034,
.031, .025, .04, .019, NA, .04, .03)
p80_1970 <- c(.503, .59, .666, .514, .585, .548, .35, .695, NA, .60, .678, .577,
.65, .606, NA, .61, NA, NA, .54)
gini1970 <- c(.425, NA, .574, .503, .520, .466, .25, .625, .539, NA, .612, .567,
NA, .558, NA, .591, .493, .449, .531)
latam70 <- data.frame(paises, p20_1970, p80_1970, gini1970)
(((ggplot(latam70 %>% filter(!(paises %in% c("Rep Dominicana", "El Salvador"))),
aes(reorder(paises, p20_1970), p20_1970, fill = paises)) +
guides(fill = "none") +
geom_col() +
coord_flip() +
scale_y_continuous(labels = scales::percent) +
labs(x="", y="", subtitle ="% participación de ingreso del 20% más pobre del país"))+
(ggplot(latam70 %>% filter(!(paises %in% c("Rep Dominicana", "Uruguay", "Paraguay",
"El Salvador"))),
aes(reorder(paises, p80_1970), p80_1970, fill = paises)) +
guides(fill = "none") +
geom_col() +
coord_flip() +
scale_y_continuous(labels = scales::percent) +
labs(x="", y="", subtitle ="% participación de ingreso del 20% más rico del país")))/
(ggplot(latam70 %>% filter(!(paises %in% c("Paraguay", "Nicaragua", "Guatemala", "Bolivia"))),
aes(reorder(paises, gini1970), gini1970, fill = paises)) +
guides(fill = "none") +
geom_col() +
coord_flip() +
scale_y_continuous(labels = scales::percent) +
labs(x="", y ="", subtitle = "Gini"))
) + plot_annotation(title = "Desigualdad en Latam circa 1970",
caption = "Elaborado con base a (Bulmer-Thomas, 2017, p. 349)")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment