1
我试图在Mollweide投影的世界地图上绘制线条失败。我还在同一张地图上绘制了点,并且效果很好。对于线条,我试图将这个例子适应我的需求:http://flowingdata.com/2011/05/11/how-to-map-connections-with-great-circles/。 我已经通过预测试(前4步)失败。在下面的代码中,该行应该连接肯尼亚和澳大利亚。它运行时没有错误,但输出中没有行。 (我还测试了例子,而不mapproj而行是存在的。)在投影图上绘制连接线(mapproj,gcIntermediate)
library("maps")
library("mapproj")
library("geosphere")
map("world",proj="mollweide", orientation= c(90,0,0), fill=TRUE, col="white", bg="lightblue")
lon_ke <- 38
lat_ke <- 1
lon_aus <- 133
lat_aus <- -27
inter <- gcIntermediate(c(mapproject(lon_ke,lat_ke), proj="mollweide", orientation= c(90,0,0)),
c(mapproject(lon_aus,lat_aus), proj="mollweide", orientation= c(90,0,0)),
n=50, addStartEnd=TRUE)
lines(inter)
我想补充一点,mapproj和gcIntermediate在我在这里找到的相同代码中的唯一用法:Rahlf,Thomas。 Data Visualization with R. Springer,2017,doi:10.1007/978-3-319-49751-8,p。 345f。您可以下载脚本[here](http://extras.springer.com/2017/978-3-319-49750-1/scriptsanddata.zip) - > maps_world_great_circles.r。我发现这个例子过于复杂,并且它不适合我,在第14行'映射(proj = myProj.type,orient = myProj.orient,wrap = T):投影失败了某些数据' – noschmi