Define Libraries

library("stringr")
library("geojsonio")
library("ggplot2")
library("ggthemes")

Define Path

dir.wrk <- getwd()
dir.data <- file.path(dir.wrk, "dataset/data")
dir.maps <- file.path(dir.wrk, "dataset/data_maps")

Define Files

file.geo <- file.path(dir.maps, "nepal_district.geojson")

Load Maps

geo <- geojsonio::geojson_read(file.geo, parse=TRUE, what="sp")
geo77 <- broom::tidy(geo, region="DISTRICT")
geo_site <- subset(geo77, geo77$id %in% c("Dhading","Sindhupalchok"))

head(geo_site)
## # A tibble: 6 x 7
##    long   lat order hole  piece group     id     
##   <dbl> <dbl> <int> <lgl> <fct> <fct>     <chr>  
## 1  84.7  27.9 68752 FALSE 1     Dhading.1 Dhading
## 2  84.7  27.9 68753 FALSE 1     Dhading.1 Dhading
## 3  84.7  27.9 68754 FALSE 1     Dhading.1 Dhading
## 4  84.7  27.9 68755 FALSE 1     Dhading.1 Dhading
## 5  84.7  27.9 68756 FALSE 1     Dhading.1 Dhading
## 6  84.7  27.9 68757 FALSE 1     Dhading.1 Dhading

Plot Choropleth Maps: Nepal with all Districts and highlighting the two study sites

# PREPARE DATA ---
d <- geo77
d$Status <- 0
d$Status[which(d$id %in% geo_site$id)] <- 1
d$Status <- as.factor(d$Status)

# DEFINE COLORS ---
cpalette.grp <- c("#FFFFFF","#BDBDBD")

# PLOT
map77 <- ggplot(data=d, aes(x=long, y=lat, group=group)) +
          geom_path() +
          geom_polygon(aes(fill=Status), color="#000000") +
          scale_fill_manual(values=cpalette.grp) +
          coord_equal() +
          theme_map() +
          theme(
            plot.title = element_text(size = 10, color="#000000", hjust=0.5),
            #aspect.ratio = 1,
            panel.grid.major = element_blank(),
            panel.grid.minor = element_blank(),
            axis.ticks = element_blank(),   
            strip.text = element_text(size = 10, color="#000000", hjust=0.5),
            strip.background = element_rect(fill="#FFFFFF", color="#FFFFFF"),
            panel.background = element_rect(fill="#FFFFFF", color=NA),
            legend.text = element_text(size = 10, color="#000000"),
            legend.title = element_blank(),
            legend.key.size = unit(0.5, "cm"),
            legend.position = "none") +
          guides(fill=guide_legend(title="No. of Households"))

map77