0

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

Rory Shaw
  • 811
  • 2
  • 9
  • 26
  • It's hard to help when your code isn't [reproducible](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example). Make sure to define variables like `gps` in your code so we can run the same thing as you to see the output you are getting. – MrFlick May 18 '15 at 16:11
  • @MrFlick I have defined GPS now in the code – Rory Shaw May 19 '15 at 10:16

0 Answers0