问题
I need to plot spatial data in a non-square map.
I have been using ggmap, and supposedly you can get non squared maps giving low-west-corner and upper-right-corner coordinates. However, actually it seems it doesn't work (reported here and here).
Anyone knows how to get rectangular maps in R/ggmap?
回答1:
If you can live without Google Maps, there are easy, immediate alternatives (I'd've included CloudMade but I don't have an enterprise account):
library(ggmap)
loc <- c(-96, 29.4, -94, 30.2)
# gmaps
tx_map_gmaps <- get_map(location=loc, source="google", maptype="terrain")
gg <- ggmap(tx_map_gmaps)
gg

# openstreetmap
tx_map_osm <- get_map(location=loc, source="osm")
gg <- ggmap(tx_map_osm)
gg

# stamen
tx_map_stamen <- get_map(location=loc, source="stamen", maptype="toner")
gg <- ggmap(tx_map_stamen)
gg

And, if you're willing to fiddle with initial zoom settings & then cropping (and, perhaps, some tile graininess), you can do it with Google Maps:
tx_map_gmaps <- get_map(location=loc, source="google", maptype="terrain")
gg <- ggmap(tx_map_gmaps)
gg <- gg + scale_y_continuous(limits=c(29.5, 30.0))
gg

(I didn't fiddle with said initial zoom, but you shld be able to get the idea.)
来源:https://stackoverflow.com/questions/31316076/non-square-rectangular-maps-in-r-ggmap