R data for Swedish administrative boundaries of counties and municipalities from 1977-2008.
library(sweboundaries) library(dplyr) library(ggplot2) m <- swe_boundaries(1996, "mun", "df") data(geo_pop) md <- geo_pop %>% filter(year == 1996) %>% left_join(m, ., by = "knkod") %>% mutate( dens = pop/(area/100), dens = cut(dens, quantile(dens), labels = c(1:4)) ) knitr::kable(md %>% select(geomid:year) %>% distinct() %>% slice(1:10))
ggplot(md, aes(long, lat, group = group, fill = dens)) + scale_fill_brewer() + geom_polygon() + coord_equal() + theme_minimal()
Inspired by USAboundaries
Data from SCB
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.