使用 as.POSIXct 内 abline
as.POSIXct
abline
plot(df$X, df$Y) abline(v = as.POSIXct("2018-04-01 00:04:47"), col = "red") abline(v = as.POSIXct("2018-04-01 00:03:44.000"), col = "blue")
df <- read.table(text = " X Y 1 '2018-04-01 00:00:34' 3.58 2 '2018-04-01 00:01:38' 2.79 3 '2018-04-01 00:02:41' -2.42 4 '2018-04-01 00:03:44' 4.60 5 '2018-04-01 00:04:47' 6.05", header = T) df <- transform(df, X = as.POSIXct(X))