我有一份来自印度北阿坎德邦的地点列表。数据集就像这样
address lat long
Ajabpur 30.0431765 78.8255226
UHC Ajabpur 30.0431765 78.8255226
Asan Bag 30.5829083 77.7523608
Ashtad 30.6865869 77.8453043
Badripur 30.2843949 78.0656264
Balawala 30.2661801 78.1062092
Ballupur 30.3335862 78.0115041
Barontha 30.066753 79.0192997
我希望使用R在Uttarakhand地图上绘制这些点。我如何实现它?
答案 0 :(得分:0)
有几个例子。
但是这里有ggplot2
和ggmap
。查看ggmap的手册,你会发现很多选项。
data_table <- read.table(text="
add lat long
Ajabpur 30.0431765 78.8255226
UHCAjabpur 30.0431765 78.8255226
AsanBag 30.5829083 77.7523608
Ashtad 30.6865869 77.8453043
Badripur 30.2843949 78.0656264
Balawala 30.2661801 78.1062092
Ballupur 30.3335862 78.0115041
Barontha 30.066753 79.0192997",
header = TRUE)
library(ggplot2)
library(ggmap)
map <- get_map(
location = c(78.825, 30.04),
source = "google", zoom = 15, maptype = "satellite"
)
ggmap(map) +
geom_point(data=data_table, aes(x = long, y = lat), alpha = .5, color="red")