问题描述
我需要在非正方形地图中绘制空间数据.
I need to plot spatial data in a non-square map.
我一直在使用ggmap,应该可以得到非平方的地图,这些地图提供了低西角和右上角的坐标.但是,实际上,它似乎不起作用(在此处报告,并且此处).
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).
有人知道如何在R/ggmap中获得矩形地图吗?
Anyone knows how to get rectangular maps in R/ggmap?
推荐答案
如果您可以不用Google Maps居住,那么有许多简便而又直接的替代方法(我已经包括了CloudMade,但我没有企业帐户):
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
而且,如果您愿意摆弄初始缩放设置&然后进行裁剪(也许还有一些平铺的纹理),您可以可以使用Google Maps做到这一点:
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.)
这篇关于R-ggmap中的非正方形(矩形)地图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!