Reputation: 41
I am trying to get the black and white version of a stamen map and its giving me the color version. I've tried downloading the map with get_map and get_stamenmap and both give me the color version regardless of whether I specify color as "bw" or "color". Any ideas or work arounds?
library(ggmap)
mapImage <- get_map(location = c(lon = -110.8, lat = 34.7),
source = "stamen",
maptype = "terrain",
color = "bw",
zoom = 7)
g <- ggmap(mapImage)
Upvotes: 4
Views: 1581
Reputation: 4135
My solution was get_stamenmap
with maptype="toner".
It is like get_map
with source="stamen"
speaks with a southern soft R and sloppy lisp dialect that stamen does not understand.
library(ggmap)
mapImage <- get_stamenmap(bbox = c(-114,32,-107,37),
source = "stamen",
maptype = "toner",
zoom = 7)
ggmap(mapImage) +theme_bw()
did the trick for me (using Rstudio in Linux, potential bug)
Notice bbox
as the alternative to location
and theme_bw()
as Sandy suggested
Upvotes: 1
Reputation: 32789
To get black-and-white stamen maps, use maptype = "toner"
. The color argument has no effect on stamen maps. You might also want a panel border around the plot. If so, use ggplot's theme_bw()
or 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()
Upvotes: 1