[英]Plotting GPS coordinates in ggmap
我有一個問題。 當我使用 ggmap 繪制我的坐標時,它不會根據日期列連接段。 我最終得到了一張奇怪的地圖。 知道如何解決這個問題嗎? 提前感謝您的幫助。
這就是所做的。
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")
geom_line
的幫助說:
Description:
Connect observations, ordered by x value.
geom_path
的幫助說:
Description:
Connect observations in original order
所以我猜你應該使用geom_path
。 這是一個猜測,因為你沒有給我們一些數據來嘗試這個。
“原始順序”是指數據框中的順序。 如果你的數據不是按日期排序的,那么它仍然會跳來跳去,但我猜(也)你的數據框是按日期排序的(這些東西通常是)。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.