I have troubles to print maps with missing data.
I am able to produce an "empty" shapefile:
empty.shape.sf <-
ggplot(BiH.shape.sf)+
geom_sf(fill="grey",colour="black")+
theme(legend.position="none",
axis.title=element_blank(),
axis.text=element_blank(),
axis.ticks = element_blank(),
strip.text.y = element_text(size = 10),
panel.background=element_rect(fill="white"))
print(empty.shape.sf)
I then add data to the shapefile
df.shape <- dplyr::left_join(BiH.shape.sf, data, by="ID_3")
and produce the new maps.
data.map <- df.shape%>%
filter(year==2000|year==2004)%>%
ggplot()+
geom_sf(aes(fill=res), colour="black")+
theme(legend.position="none",
axis.title=element_blank(),
axis.text=element_blank(),
axis.ticks = element_blank(),
strip.text.y = element_text(size = 10),
panel.background=element_rect(fill="white"))+
scale_fill_gradient(low="blue", high="red", limits=c(0,100))+
facet_wrap(~year)
print(data.map)
Why are the areas for which the projected data is missing without borders/dropped? I would have assumed that by using left_join all borders/areas remain preserved. How can I keep these borders/areas? Is there no other way than to create a 'complete' dataset which includes rows with NAs for each missing area?