Hi Colleagues.
I’m trying to plot the map of one region with a “zoom-in” map of its three municipalities. I was able to generate the basic map of the region and the municipalities. However, I cannot figure out how to do the “zoom-in” effect. The following are my codes:
# Load the shapefiles
shapefile <- read.csv
philippines_sf <- read_sf(here("shapefiles", "gadm41_PHL_2.shp"))
palawan_sf <-
read_sf(here("shapefiles", "gadm41_PHL_2.shp")) %>%
clean_names() %>%
filter(name_1 == "Palawan")
# Plot the Province (Palawan map)
palawan_plot <- ggplot() +
geom_sf(data = palawan_sf, fill = "seagreen2", color = "black") +
coord_sf(default_crs = NULL) +
theme_void() +
labs(title = "Province of Palawan")
# Plot the three municipalities/city
Balabac_sf<-
read_sf(here("shapefiles", "gadm41_PHL_2.shp")) %>%
clean_names() %>%
filter(name_1 == "Palawan") %>%
filter(name_2 == "Balabac") %>%
select(name_2, geometry)
balabac_plot <- ggplot() +
geom_sf(data = Balabac_sf, fill = "palegreen3", color = "black") +
coord_sf(default_crs = NULL) +
theme_void() +
labs(title = "Municipality of Balabac")
PuertoPrincesa_sf <-
read_sf(here("shapefiles", "gadm41_PHL_2.shp")) %>%
clean_names() %>%
filter(name_1 == "Palawan") %>%
filter(name_2 == "Puerto Princesa City") %>%
select(name_2, geometry)
PP_plot <- ggplot() +
geom_sf(data = PuertoPrincesa_sf, fill = "darkolivegreen", color = "black") +
coord_sf(default_crs = NULL) + # Set default_crs argument to NULL
theme_void() +
labs(title = "Puerto Princesa City")
Rizal_sf <-
read_sf(here("shapefiles", "gadm41_PHL_2.shp")) %>%
clean_names() %>%
filter(name_1 == "Palawan") %>%
filter(name_2 == "Rizal") %>% #choose provinces/cities to map
select(name_2, geometry)
Rizal_plot <- ggplot() +
geom_sf(data = Rizal_sf, fill = "palegreen", color = "black") +
coord_sf(default_crs = NULL) + # Set default_crs argument to NULL
theme_void() +
labs(title = "Municipality of Rizal")
#Province map with "zoom-in" map of the three municipalities?
I’m thinking of combining the plots and adding arrows or lines from the province map to the map of the three municipalities. Combining is through grid.arrange, but I can’t do the arrows or lines. I also tried “tmap” but it only generates the individual maps.
I hope you could guide me on this.
Thank you in advance.
Regards,
Echo