[英]Plotting GPS coordinates in ggmap
I have one problem.我有一个问题。 When I plot my coordinates using ggmap it does not connect segments according to date column.当我使用 ggmap 绘制我的坐标时,它不会根据日期列连接段。 I end up having a weird map.我最终得到了一张奇怪的地图。 Any idea how to fix this?知道如何解决这个问题吗? Thanks for your help in advance.提前感谢您的帮助。
this is what did.这就是所做的。
p=ggmap(mapImageData)+
geom_point(aes(x = Longitude, y = Latitude, group=DataID, color=factor(DataID)),
size = 4,
pch= 20,
data=koeco)
p + geom_line(aes(x = Longitude, y = Latitude, group=DataID, color=factor(DataID)),
size = 1,
data=koeco) +
theme_bw() +
annotate("text", x=110.3539, y=48.8, label = "Start",
colour = I("red"), size = 5) +
annotate("text", x=116.2648, y=28.5, label = "End",
colour = I("red"), size = 5) +
labs(x = "Longitude", y = "Latitude", colour = "Routes")
The help for geom_line
says: geom_line
的帮助说:
Description:
Connect observations, ordered by x value.
The help for geom_path
says: geom_path
的帮助说:
Description:
Connect observations in original order
So I'm guessing you should use geom_path
.所以我猜你应该使用geom_path
。 Its a guess because you haven't given us some data to try this on.这是一个猜测,因为你没有给我们一些数据来尝试这个。
By "original order" it means the order in the data frame. “原始顺序”是指数据框中的顺序。 If your data isn't in date-sorted order then it will still jump around, but I'm guessing (also) that your data frame is sorted by date (these things usually are).如果你的数据不是按日期排序的,那么它仍然会跳来跳去,但我猜(也)你的数据框是按日期排序的(这些东西通常是)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.