Trace path

d <- data.frame(x = c(X.coord),
                y = c(Y.coord),
                time = 1:length(X.coord))
library(ggplot2)
ggplot(d, aes(x, y)) +
  geom_path(aes(colour = as.numeric(time)))