Last active
April 15, 2023 13:20
-
-
Save juanchiem/e1110356f2fe0c3c37e3dee11b9b019a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pacman::p_load(tidyverse, sf, ggspatial, geodata) | |
# theme_set: background theme | |
theme_set(theme_bw()+ | |
theme( | |
panel.grid.major = element_line(color = gray(0.5), | |
linetype = "dashed", | |
linewidth = 0.1), | |
panel.background = element_rect(fill = "aliceblue"), | |
axis.text.x = element_text(size = 6), | |
axis.text.y = element_text(size = 6), | |
)) | |
# map of Argentina | |
AR <- geodata::gadm(country = "ARG", level = 1, path=here::here()) %>% | |
st_as_sf() | |
# level = 0 boundaries | |
# level = 1 provinces | |
# level = 2 provinces and parties | |
# load georeferenced points | |
# pts <- rio::import("data/pts.xlsx",sheet="Hoja4") | |
# st_as_sf(pts, coords = c("Longitude", "Latitude"), crs = 4326) | |
# pts | |
map <- AR %>% | |
ggplot()+ | |
geom_sf()+ | |
geom_sf(data = AR, fill = "gray98", color= "gray60", size =0.2) + | |
# geom_point(data = pts, aes(x = Longitude, y = Latitude), alpha=0.5, position = position_jitter(width = 0.35, height = 0.35))+ | |
annotation_scale(aes(location = "br", width_hint = 0.25, style= "bar"))+ | |
annotation_north_arrow(location = "tr", which_north = "true", pad_x = unit(0.25, "cm"), pad_y = unit(0.25, "cm"), | |
height = unit(1, "cm"), | |
width = unit(1, "cm")) | |
map | |
# ggsave(mapa, filename = "plots/map.png", width = 6, height = 5,units = "in", dpi=300,device = "png") |
Author
juanchiem
commented
Apr 11, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment