我想创建一张法国地图,并在不同的地图上显示不同的点。
代码很容易做到:
library(raster)
#mydata
pointA <- data.frame(longitude = c(5.819472,5.384418 ),
latitude = c(46.11558, 46.18197))
pointC <- data.frame (longitude = 4.218322,
latitude = 44.20379)
cartes <- function(point){
france <- getData('GADM', country = 'FRA', level = 1) # Map of France
plot(france, border = "red", main = "Name of the point")
points(point$longitude, point$latitude)
}
cartes(pointA)
cartes(pointC)
但我无法找到根据要点名称更改标题的方法。。。
你知道怎么做吗?
使用ensym()
可能会对您有所帮助:
library(raster)
#mydata
pointA <- data.frame(longitude = c(5.819472,5.384418 ),
latitude = c(46.11558, 46.18197))
pointC <- data.frame (longitude = 4.218322,
latitude = 44.20379)
cartes <- function(point){
france <- getData('GADM', country = 'FRA', level = 1) # Map of France
plot(france, border = "red", main = ensym(point))
points(point$longitude, point$latitude)
}
cartes(pointA)
cartes(pointC)