使用get_map获取黑白花蕊地图

4

我正在尝试获取一张斯泰门地图的黑白版本,但是返回的却是彩色版本。我已经尝试使用get_map和get_stamenmap下载该地图,但无论我指定颜色为"bw"还是"color",都会返回彩色版本。有什么想法或解决方法吗?

library(ggmap)
mapImage <- get_map(location = c(lon = -110.8, lat = 34.7),
                source = "stamen",
                maptype = "terrain",
                color = "bw",
                zoom = 7)
g <- ggmap(mapImage) 

enter image description here

2个回答

1
要获取黑白花丝地图,请使用maptype = "toner"。颜色参数对花丝地图没有影响。您可能还想在绘图周围添加面板边框。如果是这样,请使用ggplot的theme_bw()theme(panel.border = element_rect(fill = NA, colour = "black"))
library(ggmap)
mapImage <- get_map(location = c(lon = -110.8, lat = 34.7),
                source = "stamen",
                maptype = "toner",
                # color = "bw",
                zoom = 7)
ggmap(mapImage) + theme_bw()

enter image description here


1
我的解决方案是使用 maptype="toner"get_stamenmap
这就像 source="stamen"get_map 说着带有南方轻柔的R音和不清晰的口齿,而 stamen 却听不懂。
library(ggmap)
mapImage <- get_stamenmap(bbox = c(-114,32,-107,37),
                    source = "stamen",
                    maptype = "toner",
                    zoom = 7)
ggmap(mapImage) +theme_bw()

对我有用(在Linux中使用Rstudio,可能存在bug)

请注意bbox作为locationtheme_bw()的替代方案,正如Sandy所建议的。

enter image description here


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接