R言語描画接続パス図(ブエノスアイレス-パリ-朔陽-メルボルンから)

# Dplyr for data wrangling and pipe function
library(dplyr)
# Load geosphere
library(geosphere)
library(maps)
# Background map
map('world',
    col="#f2f2f2", fill=TRUE, bg="white", lwd=0.05,
    mar=rep(0,4),border=0, ylim=c(-80,80) 
)
# Cities
Buenos_aires <- c(-58,-34)
Paris <- c(2,49)
Melbourne <- c(145,-38)
ShuYang=c(119.10,34.25)
# Dot for cities
#points(x=data$long, y=data$lat, col="slateblue", cex=3, pch=20)

# Compute the connection between Buenos Aires and Paris
inter <- gcIntermediate(Paris,  Buenos_aires, n=50, addStartEnd=TRUE, breakAtDateLine=F)



# Data frame
data <- rbind(Buenos_aires, Paris, Melbourne,ShuYang) %>% 
  as.data.frame()
colnames(data) <- c("long","lat")

# Show the cities on the map
map('world',
    col="#f2f2f2", fill=TRUE, bg="white", lwd=0.05,
    mar=rep(0,4),border=0, ylim=c(-80,80) 
)
points(x=data$long, y=data$lat, col="slateblue", cex=3, pch=20)
# Show this connection
lines(inter, col="slateblue", lwd=2)

# Between Paris and ShuYang
inter <- gcIntermediate(ShuYang, Paris, n=50, addStartEnd=TRUE, breakAtDateLine=F)             
lines(inter, col="slateblue", lwd=2)
# Between Melbourne and ShuYang
inter <- gcIntermediate(Melbourne, ShuYang, n=50, addStartEnd=TRUE, breakAtDateLine=F)             
lines(inter, col="slateblue", lwd=2)

ここに画像の説明を挿入
開発ツール: RStudio
WeChat Alt+A スクリーンショット ツール

おすすめ

転載: blog.csdn.net/m0_38127487/article/details/132134886