Description Usage Value Examples
Combines .kml data and NUTS2 regional mappings
1 |
A tibble with the merged data
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | x <- prep_mapdata() %>% left_join(co2em, by = c("CAPRI_NUTS_ID" = "region"))
# remove Portuguese islands and Canarias to remove empty spaces on EU maps...
x <- x %>% filter(!grepl("PT20", CAPRI_NUTS_ID)) %>% filter(!grepl("PT30", CAPRI_NUTS_ID)) %>% filter(!grepl("ES70", CAPRI_NUTS_ID))
# prepare the map with ggplot
p <- x %>% filter(!grepl("TR.*", CAPRI_NUTS_ID)) %>%
ggplot(aes(longitude, latitude, group = name, fill = pc)) +
geom_polygon(color = "white") +
coord_map("albers", lat0=30, lat1=35) +
scale_fill_gradient(low = "red", high = "white") +
labs(x = "", y = "") + theme(
axis.text.x = element_blank(),
axis.text.y = element_blank(),
axis.ticks = element_blank())
p$labels$fill <- " "
# save map to .png
p
ggsave("mapout/emission_changes.png", width = 16, height = 9)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.