我正在尝试在r中绘制地图网络。 但是,我无法在中国港口和美国港口之间划清界限。 请在屏幕截图下方找到附件,以获取详细信息。
可以帮忙吗?
library(maps)
library(geosphere)
map("world", col = "skyblue", fill = T, bg = "grey", lwd = 0.1, border = "white")
global <- Copy.of.global
export <- export
head(global)
points(x = global$longitude, y = global$latitude, pch = 19, col = "red", cex = 1)
col3 <- adjustcolor("red", alpha = 0.4)
col4 <- adjustcolor("orange", alpha = 0.4)
edge.pal <- colorRampPalette(c(col3, col4), alpha = T)
edge.col <- edge.pal(100)
for (i in 1:nrow(export)) {
x <- global[global$ID == export[i,]$Source, ]
y <- global[global$ID == export[i,]$Target, ]
arc <- gcIntermediate(c(x[1,]$longitude, x[1,]$latitude),
c(y[1,]$longitude, y[1,]$latitude),
n=50, addStartEnd = T)
lines(arc, col = "purple", lwd =2)
}