You can do this with the animation package. Install the package and then # Load the package library(animation) # This representation makes your data more portable using the dput() function: pen <- structure(list(x = c(1073L, 1072L, 1066L, 1052L, 1030L, 1009L, 994L), y = c(1058L, 1085L, 1117L, 1152L, 1196L, 1242L, 1286L), time = c(769.05, 769.07, 769.08, 769.1, 769.12, 769.13, 769.14 )), .Names = c("x", "y", "time"), class = "data.frame", row.names = c("1", "2", "3", "4", "5", "6", "7")) # Compute the time between each step diftime <- diff(pen$time) # Draw a blank plot window using the ranges for x and y with(pen, plot(NA, xlim=c(min(x), max(x)), ylim=c(min(y), max(y)), xlab="", ylab="", axes=FALSE)) # Pause for a second ani.pause(1) # Draw the curve pausing between points. for(i in 1:6) { ani.pause(diftime[i]*10) # Multiply by ten to slow things down segments(pen$x[i], pen$y[i], pen$x[i+1], pen$y[i+1]) }
------------------------------------- David L Carlson Department of Anthropology Texas A&M University College Station, TX 77840-4352 -----Original Message----- From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of AjayT Sent: Tuesday, March 3, 2015 8:59 AM To: r-help@r-project.org Subject: [R] 2D Timeseries trace plot Hi, I've got a 2D timeseries of handwriting samples, x y time 1 1073 1058 769.05 2 1072 1085 769.07 3 1066 1117 769.08 4 1052 1152 769.10 5 1030 1196 769.12 6 1009 1242 769.13 7 994 1286 769.14 upto 500 I was just wondering how to plot this as an animation, so that the points join up as they are rendered in time. Basically showing how the person who generated the data writes. The time index is not regular and if possible I'd like to avoid padding the data with duplicate entries if this is avoidable. For example adding a duplicate of the first row, for a 'padded' time 769.06. Thanks alot for your help :) -- View this message in context: http://r.789695.n4.nabble.com/2D-Timeseries-trace-plot-tp4704127.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.