从 ggmap 中移动 google 标签的位置

问题描述

我使用 ggmap() 创建了以下瑞士地图:

enter image description here

这是地图的代码

map <- get_googlemap(center = c(lon = 8.3,lat = 46.5),zoom = 7,scale = 2,maptype ='satellite',size = c(640,640))
ggmap(map_transparent) +
geom_polygon(aes(x = long,y = lat,group=id),data = shape_switzerland,color ="white",fill ="orangered4",alpha = .2,size = 0.4) +
ggsn::scalebar(x.min = 9.5,x.max = 11,y.min = 45,y.max = 45.25,dist = 100,dist_unit = "km",transform = T,model = "wgs84",height = 0.4,st.dist = 0.4,location = "topright",st.color = "black",st.size = 4) +

您将无法重现此示例,因为您没有 shapefile shape_switzerland,但对于我的问题,这不是必需的 ;)

我通过在代码添加这两行来更改地图的大小:

scale_x_continuous(limits = c(5,12)) 
scale_y_continuous(limits = c(45,48)) 

结果:

enter image description here

这基本上正是我想要的,但在第二张地图上,谷歌标签被剪掉了。我如何“移动”标签,使其像在第一张地图上一样可见?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)