我需要你的帮助,我提供了下面的示例代码。我的问题涉及将“map2”放置在“map1”左上角的正方形中,并添加从“map2”到“map1”上特定位置的箭头。我搜索了该网站,但最常讨论的主题与合并两个数据层有关。
如果您能帮助我,我将不胜感激。
library (tidyverse)
library (rnaturalearth)
world <- rnaturalearth::ne_countries(scale = "medium", returnclass = "sf")
map1<- ggplot(data = world) +
geom_sf() +
#annotation_scale(location = "bl", width_hint = 0.2) +
#annotation_north_arrow(location = "tr", which_north = "true",
# pad_x = unit(0.83, "in"), pad_y = unit(0.02, "in"),
# style = north_arrow_fancy_orienteering) +
coord_sf(xlim = c(35, 48), ylim=c(12, 22))+
xlab("Longtitude")+
ylab("Latitude")
map2<- ggplot(data = world) +
geom_sf() +
#annotation_scale(location = "bl", width_hint = 0.2) +
#annotation_north_arrow(location = "tr", which_north = "true",
# pad_x = unit(0.83, "in"), pad_y = unit(0.02, "in"),
# style = north_arrow_fancy_orienteering) +
coord_sf(xlim = c(5, 45), ylim=c(5, 45))+
xlab("Longtitude")+
ylab("Latitude")
map2