bts = 60
g <- ggplot() +
# Outline Map of Haryana and districts
geom_sf(
data = hy_map,
colour = mypal[1],
fill = bg_col,
linewidth = 0.2,
linejoin = "round",
alpha = 0.9
) +
# Plotting Roads of Haryana
# Motorways
geom_sf(
data = hy_roads1$osm_lines |>
st_transform(crs = 4326) |>
st_intersection(hy_map),
colour = mypal[2],
alpha = 1,
linewidth = 0.6,
linetype = 1
) +
# Trunk Roads
geom_sf(
data = hy_roads$osm_lines |>
st_transform(crs = 4326) |>
st_intersection(hy_map),
colour = mypal[2],
alpha = 1,
linewidth = 0.5,
linetype = 1
) +
# Primary Roads
geom_sf(
data = hy_roads2$osm_lines |>
st_transform(crs = 4326) |>
st_intersection(hy_map),
colour = mypal[3],
alpha = 0.8,
linewidth = 0.4,
linetype = 1
) +
# Secondary Roads
geom_sf(
data = hy_roads3$osm_lines |>
st_transform(crs = 4326) |>
st_intersection(hy_map),
colour = mypal[3],
alpha = 0.8,
linewidth = 0.3,
linetype = 1
) +
# Tertiary Roads
geom_sf(
data = hy_roads4$osm_lines |>
st_transform(crs = 4326) |>
st_intersection(hy_map),
colour = mypal[4],
alpha = 0.7,
linewidth = 0.2,
linetype = 1
) +
# Labels of the districts names
geom_sf_text(
data = hy_map,
colour = text_col,
mapping = aes(
label = district
),
size = bts/3,
family = "body_font",
alpha = 0.4
) +
# Themes and Labels
labs(
title = plot_title,
subtitle = plot_subtitle,
caption = plot_caption
) +
ggthemes::theme_map(
base_size = bts,
base_family = "body_font"
) +
theme(
text = element_text(
colour = text_hil
),
plot.title = element_text(
size = bts * 4.5,
hjust = 0.5,
face = "bold",
margin = margin(5,0,5,0, "mm"),
colour = text_hil,
family = "title_font"
),
plot.caption = element_textbox(
colour = text_hil,
hjust = 0.5,
family = "body_font",
margin = margin(0,0,0,0, "mm"),
size = bts / 1.5
),
plot.subtitle = element_textbox(
colour = text_hil,
hjust = 0.5,
margin = margin(5,0,0,0, "mm"),
size = 1.2 * bts
),
plot.title.position = "plot",
plot.margin = margin(10, -20, 10, -20, "mm")
)