簡體   English   中英

在時間戳值上繪制(x,y)坐標

[英]Plotting (x,y) coordinates over timestamp values

我有具有相應時間戳記值的運動數據(x,y)坐標,我需要在R中進行繪制gvisMotionChart()和其他googleVis產品似乎不接受時間戳記值。 有關R包的任何想法可用於隨時間可視化此運動數據? 樣本數據如下:

timestamp                    x    y
Feb 17, 2013 8:33:24 PM.000  724 414
Feb 17, 2013 8:34:24 PM.000  398 769
Feb 17, 2013 8:43:27 PM.000  398 769
Feb 17, 2013 8:44:15 PM.000  637 1083

在此先感謝您的幫助!

嘗試這個:

DF <- read.table(text="timestamp; x; y
Feb 17, 2013 8:33:24 PM.000; 724; 414
Feb 17, 2013 8:34:24 PM.000; 398; 769
Feb 17, 2013 8:43:27 PM.000; 398; 769
Feb 17, 2013 8:44:15 PM.000; 637; 1083",
header=TRUE,sep=";",stringsAsFactors=FALSE)

DF$timestamp <- as.numeric(strptime(DF$timestamp,
                                    "%b %d, %Y %I:%M:%S %p.000",tz="GMT"))
DF$timestamp <- DF$timestamp-min(DF$timestamp)
DF$ID <- 1


library(googleVis)
M1 <- gvisMotionChart(DF, idvar="ID", timevar="timestamp",xvar="x", yvar="y")
plot(M1)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM