Visualizing the proportion of conventional households using various sources of cooking fuel: Data from the Kenya 2019 census

Libraries

pacman::p_load(tidyverse, sf, rKenyaCensus, RColorBrewer, patchwork, extrafont)

mytheme <- theme(
  legend.title = element_text(family = "Papyrus", face = "bold"),
  legend.text = element_text(family = "Papyrus", face = "bold"),
  plot.subtitle = element_text(family = "Papyrus", face = "bold", hjust = 0.5)
)

Data

keshp <- rKenyaCensus::KenyaCounties_SHP %>% 
  st_as_sf() %>% 
  st_transform(crs = 4326) # Counties shapefiles
## Loading required package: sp
cooking_fuel <- rKenyaCensus::V4_T2.18 %>% 
  filter(County != 'xxx',
         AdminArea == 'County')

ke_combined <- left_join(keshp, cooking_fuel, by = c('County' = 'County'))

Visualizations

Paraffin <- ggplot(ke_combined) +
  geom_sf(aes(fill = Paraffin)) +
  theme_void() +
  scale_fill_gradient(
    low = "#F0EDEA",
    high = "turquoise",
    na.value = "transparent",
    name = "Paraffin"
  ) +
  mytheme +
  labs(
    subtitle = 'Parrafin'
  )


LPG <- ggplot(ke_combined) +
  geom_sf(aes(fill = `Gas(LPG)`)) +
  theme_void() +
  scale_fill_gradient(
    low = "#F0EDEA",
    high = "#4daf4a",
    na.value = "transparent",
    name = "LPG") +
  mytheme +
  labs(
    subtitle = 'LPG'
  )


Firewood <- ggplot(ke_combined) +
  geom_sf(aes(fill = Firewood)) +
  theme_void() +
  scale_fill_gradient(
    low = "#F0EDEA",
    high = "#e41a1c",
    na.value = "transparent",
    name = "Firewood") +
  mytheme +
  labs(
    subtitle = 'Firewood'
  )

Charcoal <- ggplot(ke_combined) +
  geom_sf(aes(fill = Charcoal)) +
  theme_void() +
  scale_fill_gradient(
    low = "#F0EDEA",
    high = "#544800",
    na.value = "transparent",
    name = "Charcoal") +
  mytheme +
  labs(
    subtitle = "Charcoal"
  )

Patching the plots together

ptch <- (LPG | Paraffin)/ (Firewood | Charcoal)

ptch + plot_annotation(title = "Proportion of conventional households\n using different types of cooking fuel in Kenya",
                       caption = "Credits: kevinson_m \n Data: rKenyaCensus") &
  theme(
    plot.title = element_text(family = "Papyrus", face = "bold", hjust = 0.5),
    plot.caption = element_text(family = "Papyrus", face = "bold")
  )