Skip to content

Instantly share code, notes, and snippets.

@axjack
Created December 10, 2019 12:05
Show Gist options
  • Save axjack/96d3d28e64e51f84d43385f45ed9a2a1 to your computer and use it in GitHub Desktop.
Save axjack/96d3d28e64e51f84d43385f45ed9a2a1 to your computer and use it in GitHub Desktop.
経過時間をプロットする
pc.data <- c("2019-12-10 19:13:10.100",
"2019-12-10 19:13:10.200",
"2019-12-10 19:15:21.344",
"2019-12-10 19:16:25.344",
"2019-12-10 19:16:28.134",
"2019-12-10 19:18:25.56",
"2019-12-10 19:19:31.798"
)
options(digits.secs=3)
pc.data.po <- as.POSIXct(pc.data,format="%Y-%m-%d %H:%M:%OS")
x = pc.data.po - pc.data.po[1]
y = 1.3 * ( pc.data.po - pc.data.po[1] )
xn <- length(x)
plot(as.numeric(x), type="l", xlim=c(1,xn),xaxp=c(1,xn,3), ylim=c(0,1.5*max(as.numeric(x))), xlab="Event Number", ylab="Elapsed Time(sec)", main="Server vs PC")
par(new=T)
plot(as.numeric(y), type="l", col="red", ylim=c(0,1.5*max(as.numeric(x))), xaxt="n", yaxt="n",ylab="",xlab="")
legend("topleft",legend=c("svr","pc"),col=c("black","red"), lty=c(1,1))