Created
December 1, 2022 10:11
-
-
Save dakvid/5dc0e5386d5989d99269c9c6c3e19e39 to your computer and use it in GitHub Desktop.
#30DayMapChallenge 2022 - Day 02 - Lines
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
# Simple map of state highways | |
library(dplyr) | |
library(sf) | |
library(ggplot2) | |
library(sysfonts) | |
font_add_google("Tinos") | |
COL_FG <- "white" | |
COL_BG <- "black" | |
MAP_FONT <- "Tinos" | |
# https://data.linz.govt.nz/layer/53382-nz-roads-addressing/ | |
roads <- | |
st_read("2021/roads/nz-roads-addressing.gpkg") | |
sh <- | |
roads |> | |
filter(route_name_body == "State Highway") |> | |
arrange(route_name_number) | |
gg_sh <- | |
ggplot() + | |
geom_sf(data = sh, | |
linewidth = 0.5, colour = COL_FG) + | |
labs(title = "State Highways of New Zealand", | |
subtitle = "#30DayMapChallenge 2022 | Day 2 | Lines", | |
caption = "@dakvid, David Friggens") + | |
theme_void(base_family = MAP_FONT) + | |
theme(plot.background = element_rect(fill = COL_BG, colour = COL_BG), | |
panel.background = element_rect(fill = COL_BG, colour = COL_BG), | |
plot.title = element_text(size = 48, colour = COL_FG, hjust = 0.5, margin = margin(c(10,0,0,0))), | |
plot.subtitle = element_text(size = 28, colour = COL_FG, hjust = 0.5), | |
plot.caption = element_text(size = 20, colour = COL_FG, hjust = 0.5, margin = margin(c(-10, 0, 5, 0)))) | |
ggsave("day_2_lines.png", | |
plot = gg_sh, | |
path = "Day_02_Lines/", | |
width = 900, height = 1500, units = "px") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment