向ggmake plot添加点时出错
Error in adding points to ggmake plot
我正在尝试使用 ggmake 创建一个地块,该地块已创建,但随后我想使用 geom_point 添加点,为此我给出了城市的经度和纬度但未能实现,因为一个错误,下面我粘贴了包含经度和纬度的代码和数据框。
City Longitude Latitude
Mastung 66.84691 29.4087
Khuzdaar 66.611691 27.812
Khaich 63.01475 26.156
Panjgore 64.112336 26.97524
Quetta 66.998734 30.1829713
Dera Bugti 69.159609 29.035158
Kohlo 69.24901 29.8975
Kalat 66.5878 29.0303
Kharaan 65.4222 28.5812
Nooshki 66.0195 29.555
kl <- read.csv(file.choose())
map <- get_map(location=c(66.214995,28.538837), zoom=7) + geom_point(data =
kl,aes(x =longitude,y = latitude,size =4),color='red')
Error:Error in Ops.raster(get_map(location = c(66.214995, 28.538837), zoom = 7),
: operator not meaningful for raster objects
如何绘制这些点并消除此错误?
kl <- read.table(text='
City longitude latitude
"Mastung" 66.84691 29.4087
"Khuzdaar" 66.611691 27.812
"Khaich" 63.01475 26.156
"Panjgore" 64.112336 26.97524
"Quetta" 66.998734 30.1829713
"Dera Bugti" 69.159609 29.035158
"Kohlo" 69.24901 29.8975
"Kalat" 66.5878 29.0303
"Kharaan" 65.4222 28.5812
"Nooshki" 66.0195 29.555
', header=T)
library(ggmap)
mp <- get_map(location=c(66.214995,28.538837), zoom=7)
ggmap(mp) +
geom_point(data=kl, aes(x=longitude, y=latitude), color='red', size=4)
我正在尝试使用 ggmake 创建一个地块,该地块已创建,但随后我想使用 geom_point 添加点,为此我给出了城市的经度和纬度但未能实现,因为一个错误,下面我粘贴了包含经度和纬度的代码和数据框。
City Longitude Latitude
Mastung 66.84691 29.4087
Khuzdaar 66.611691 27.812
Khaich 63.01475 26.156
Panjgore 64.112336 26.97524
Quetta 66.998734 30.1829713
Dera Bugti 69.159609 29.035158
Kohlo 69.24901 29.8975
Kalat 66.5878 29.0303
Kharaan 65.4222 28.5812
Nooshki 66.0195 29.555
kl <- read.csv(file.choose())
map <- get_map(location=c(66.214995,28.538837), zoom=7) + geom_point(data =
kl,aes(x =longitude,y = latitude,size =4),color='red')
Error:Error in Ops.raster(get_map(location = c(66.214995, 28.538837), zoom = 7),
: operator not meaningful for raster objects
如何绘制这些点并消除此错误?
kl <- read.table(text='
City longitude latitude
"Mastung" 66.84691 29.4087
"Khuzdaar" 66.611691 27.812
"Khaich" 63.01475 26.156
"Panjgore" 64.112336 26.97524
"Quetta" 66.998734 30.1829713
"Dera Bugti" 69.159609 29.035158
"Kohlo" 69.24901 29.8975
"Kalat" 66.5878 29.0303
"Kharaan" 65.4222 28.5812
"Nooshki" 66.0195 29.555
', header=T)
library(ggmap)
mp <- get_map(location=c(66.214995,28.538837), zoom=7)
ggmap(mp) +
geom_point(data=kl, aes(x=longitude, y=latitude), color='red', size=4)