I'm using ggmap in R to plot gps coordinates on to a map. Currently the points are all the same colour - red. Is it possible to relate the colour to the timestamp - ie create a gradient to show direction of travel?
The code I am currently using is:
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)
Here is a line of data from the csv file I am using: "_id",lon,timestamp,lat 5555c11465bc7d11180bc36c,-4.018596666666666,2015-05-15T09:49:08.328Z,53.2394
Any ideas?
Thanks