ErinV
ErinV

Reputation: 41

Acquiring black and white stamen maps with get_map

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) 

enter image description here

Upvotes: 4

Views: 1581

Answers (2)

AWE
AWE

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

enter image description here

Upvotes: 1

Sandy Muspratt
Sandy Muspratt

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()

enter image description here

Upvotes: 1

Related Questions