| esp_get_gridmap | R Documentation |
sf hexbin or squared POLYGON of SpainLoads a hexbin map (sf object) or a map of squares with the
boundaries of the provinces or autonomous communities of Spain.
esp_get_hex_prov(prov = NULL)
esp_get_hex_ccaa(ccaa = NULL)
esp_get_grid_prov(prov = NULL)
esp_get_grid_ccaa(ccaa = NULL)
prov, ccaa |
character. A vector of names and/or codes for provinces
and autonomous communities or |
Hexbin (or grid) maps have an advantage over traditional choropleth maps. In choropleths, regions with larger polygons tend to appear more prominent simply because of their size, which introduces visual bias. With hexbin maps, each region is represented equally, reducing this bias.
You can use and mix names, ISO codes, "codauto"/ "cpro" codes (see
esp_codelist) and NUTS codes of different levels.
When using a code corresponding to a higher level (e.g.
esp_get_prov("Andalucia")) all the corresponding units of that level are
provided (in this case, all the provinces of Andalusia).
Results are provided in EPSG:4258, use sf::st_transform()
to change the projection.
A sf object.
esp_get_simpl.
Other datasets representing political borders:
esp_get_capimun(),
esp_get_ccaa(),
esp_get_ccaa_siane(),
esp_get_comarca(),
esp_get_countries_siane(),
esp_get_munic(),
esp_get_munic_siane(),
esp_get_nuts(),
esp_get_prov(),
esp_get_prov_siane(),
esp_get_simpl,
esp_get_spain(),
esp_get_spain_siane(),
esp_siane_bulk_download()
esp <- esp_get_spain()
hexccaa <- esp_get_hex_ccaa()
library(ggplot2)
ggplot(hexccaa) +
geom_sf(data = esp) +
geom_sf(aes(fill = codauto), alpha = 0.3, show.legend = FALSE) +
geom_sf_text(aes(label = label), check_overlap = TRUE) +
theme_void() +
labs(title = "Hexbin: CCAA")
hexprov <- esp_get_hex_prov()
ggplot(hexprov) +
geom_sf(data = esp) +
geom_sf(aes(fill = codauto), alpha = 0.3, show.legend = FALSE) +
geom_sf_text(aes(label = label), check_overlap = TRUE) +
theme_void() +
labs(title = "Hexbin: Provinces")
gridccaa <- esp_get_grid_ccaa()
ggplot(gridccaa) +
geom_sf(data = esp) +
geom_sf(aes(fill = codauto), alpha = 0.3, show.legend = FALSE) +
geom_sf_text(aes(label = label), check_overlap = TRUE) +
theme_void() +
labs(title = "Grid: CCAA")
gridprov <- esp_get_grid_prov()
ggplot(gridprov) +
geom_sf(data = esp) +
geom_sf(aes(fill = codauto), alpha = 0.3, show.legend = FALSE) +
geom_sf_text(aes(label = label), check_overlap = TRUE) +
theme_void() +
labs(title = "Grid: Provinces")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.