g <- ggplot () +
# Outline Map of Haryana and districts
geom_sf (
data = hy_map,
colour = "grey15" ,
fill = "grey98" ,
linewidth = 0.4 ,
linejoin = "round"
) +
# Main Roads of Haryana - Motorways, Trunk, Primary & Secondary Roads
geom_sf (
data = hy_roads1$ osm_lines |>
st_transform (crs = 4326 ) |>
st_intersection (hy_map),
colour = "grey30" ,
alpha = 0.5 ,
linewidth = 0.4 ,
linetype = 1
) +
geom_sf (
data = hy_roads$ osm_lines |>
st_transform (crs = 4326 ) |>
st_intersection (hy_map),
colour = "grey30" ,
alpha = 0.4 ,
linewidth = 0.2 ,
linetype = 1
) +
geom_sf (
data = hy_roads2$ osm_lines |>
st_transform (crs = 4326 ) |>
st_intersection (hy_map),
colour = "grey30" ,
alpha = 0.4 ,
linewidth = 0.1 ,
linetype = 1
) +
geom_sf (
data = hy_roads3$ osm_lines |>
st_transform (crs = 4326 ) |>
st_intersection (hy_map),
colour = "grey30" ,
alpha = 0.3 ,
linewidth = 0.1 ,
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.5
) +
# Pharmacies
geom_sf (
data = hy_health_pharmacy$ osm_points |>
st_transform (crs = 4326 ) |>
st_intersection (hy_map),
colour = mypal[1 ],
size = 3 ,
pch = 1 ,
linewidth = 0.2
) +
# Hospitals
geom_sf (
data = hy_health_hospitals$ osm_points |>
st_transform (crs = 4326 ) |>
st_intersection (hy_map),
colour = mypal[3 ],
size = 3 ,
pch = 1 ,
linewidth = 0.2
) +
# geom_sf(
# data = hy_health_hospitals$osm_polygons |>
# st_transform(crs = 4326) |>
# st_intersection(hy_map),
# colour = mypal[3],
# linewidth = 0.5
# ) +
# geom_sf(
# data = hy_health_hospitals$osm_multipolygons |>
# st_transform(crs = 4326) |>
# st_intersection(hy_map),
# colour = mypal[3],
# linewidth = 0.5
# ) +
# Doctors, Dentists etc.
geom_sf (
data = hy_health_docs$ osm_points |>
st_transform (crs = 4326 ) |>
st_intersection (hy_map),
colour = mypal[2 ],
size = 3 ,
pch = 1 ,
linewidth = 0.2
) +
# geom_sf(
# data = hy_health_docs$osm_polygons |>
# st_transform(crs = 4326) |>
# st_intersection(hy_map),
# colour = mypal[2],
# linewidth = 0.5
# ) +
# 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 * 3.5 ,
hjust = 0.5 ,
face = "bold" ,
margin = margin (5 ,0 ,5 ,0 , "mm" ),
colour = text_hil
),
plot.caption = element_textbox (
colour = text_hil,
hjust = 0.5 ,
family = "caption_font" ,
margin = margin (0 ,0 ,0 ,0 , "mm" ),
size = bts / 3
),
plot.subtitle = element_textbox (
colour = text_hil,
hjust = 0.5 ,
face = "bold" ,
margin = margin (5 ,0 ,0 ,0 , "mm" ),
size = 2 * bts
),
plot.title.position = "plot" ,
plot.margin = margin (10 , - 20 , 10 , - 20 , "mm" )
)
ggsave (
filename = here:: here ("data_vizs" , "poster_health_map_hy.png" ),
plot = g,
width = 24 ,
height = 36 ,
units = "in" ,
bg = "white"
)