我正在尝试将比例尺添加到从Google获得的地图中。我想在左上角放置比例尺,但是它放置不正确(距离角落有点远)。我知道它与地图的范围有关,但是我不知道如何解决它。
library(ggplot2)
library(ggsn)
library(ggmap)
ca <- get_map(location = c(-124.29, 40.75, -123.91, 40.97), maptype = "terrain", source = "google", force = T)
ggmap(ca) +
coord_sf(crs = st_crs(4326), expand = FALSE) +
scalebar(x.min = -124.29, x.max = -123.91, y.min = 40.75, y.max = 40.97,
location = "topleft",
dist = 5,
dist_unit = "km",
transform = TRUE,
model = "WGS84",
st.dist = 0.04)