I am having some problems adding a vertical line to a gplot2 graph.
My example dataframe is listed below.
set.seed(1234)
df <- data.frame(Date=seq
You have to replace as.Date()
with as.POSIXct()
because you also need time not just date (function as.Date()
represents only date part).
g + geom_vline(xintercept=as.numeric(as.POSIXct("2013-02-21 14:00:00")))
You can see the difference by looking on those two cases:
as.Date("2013-02-21 14:00:00")
[1] "2013-02-21"
as.POSIXct("2013-02-21 14:00:00")
[1] "2013-02-21 14:00:00 EET"