# NOT RUN {
prov <- esp_get_prov()
library(ggplot2)
ggplot(prov) +
geom_sf() +
theme_void()
# Random Provinces
Random <-
esp_get_prov(prov = c(
"Zamora",
"Palencia",
"ES-GR",
"ES521",
"01"
))
ggplot(Random) +
geom_sf(aes(fill = codauto), show.legend = FALSE, alpha = 0.5) +
scale_fill_manual(values = hcl.colors(
nrow(Random), "Spectral"
)) +
theme_minimal()
# All Provinces of a Zone plus an addition
Mix <- esp_get_prov(prov = c(
"Noroeste",
"Castilla y Leon", "La Rioja"
))
Mix$CCAA <- esp_dict_region_code(
Mix$codauto,
origin = "codauto"
)
ggplot(Mix) +
geom_sf(aes(fill = CCAA), alpha = 0.5) +
scale_fill_discrete(type = hcl.colors(5, "Temps")) +
theme_classic()
# ISO codes available
allprovs <- esp_get_prov()
ggplot(allprovs) +
geom_sf(fill = NA) +
geom_sf_text(aes(label = iso2.prov.code),
check_overlap = TRUE,
fontface = "bold"
) +
theme_void()
# }
Run the code above in your browser using DataLab