|
|
|
% Generated by roxygen2: do not edit by hand
|
|
|
|
% Please edit documentation in R/capri_maps.r
|
|
|
|
\name{prep_mapdata}
|
|
|
|
\alias{prep_mapdata}
|
|
|
|
\title{Prepares the data to be mapped directly}
|
|
|
|
\usage{
|
|
|
|
prep_mapdata()
|
|
|
|
}
|
|
|
|
\value{
|
|
|
|
A tibble with the merged data
|
|
|
|
}
|
|
|
|
\description{
|
|
|
|
Combines .kml data and NUTS2 regional mappings
|
|
|
|
}
|
|
|
|
\examples{
|
|
|
|
|
|
|
|
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)
|
|
|
|
|
|
|
|
} |