我在R中使用ggmap将gps坐标绘制到地图上。目前这些点都是相同的颜色 - 红色。是否可以将颜色与时间戳相关联 - 即创建一个梯度来显示旅行方向?
我目前使用的代码是:
install.packages("ggplot2")
install.packages("ggmap")
install.packages("RgoogleMaps")
# ggplot2 and ggmap packages installed
setwd("C:/Users/afpe6c/Dropbox/EPSRC PostDoc/GPS Tracker/GPS & accelerometer testing/15-5-15/")
# this sets the working directory in which the csv file is located
gps = read.csv("15-5-15 1030-1040 gps range test lat long.csv", header = TRUE)
library(ggmap)
# set map base and center on median lon and lat
mapImageData <- get_googlemap(center = c(lon = median(gps$lon), lat = median(gps$lat)),zoom = 17,size = c(500, 500),maptype = c("satellite"))
ggmap(mapImageData,extent = "device") + geom_point(aes(x = lon,y = lat),data = gps,colour = "red",size = 1,pch = 20)
以下是我正在使用的csv文件中的一行数据: “_id”,LON,时间戳,LAT 5555c11465bc7d11180bc36c,-4.018596666666666,2015-05-15T09:49:08.328Z,53.2394
有什么想法吗?
由于