X-Git-Url: http://git.onelab.eu/?p=monitor.git;a=blobdiff_plain;f=statistics%2Ffunctions.r;h=d9e402385d9485528a6023b581fbc529aee9d90b;hp=bc6b8d49311d94adaecd53a4024ced223a26e9a8;hb=a403ef9f15068971de470ce7c66c59252b118f39;hpb=db84a19276e861081756a7daec54aba8a1507abe diff --git a/statistics/functions.r b/statistics/functions.r index bc6b8d4..d9e4023 100644 --- a/statistics/functions.r +++ b/statistics/functions.r @@ -397,10 +397,15 @@ add_timestamp <- function (t) return (t); } -abline_at_date <- function (date, col='black', lty=1, format="%Y-%m-%d") +abline_at_date <- function (date, col='black', lty=1, format="%Y-%m-%d", height=0) { ts <-unclass(as.POSIXct(date, format=format, origin="1970-01-01"))[1] - abline(v=ts, col=col, lty=lty) + if ( height == 0 ) + { + abline(v=ts, col=col, lty=lty) + } else { + lines(c(ts,ts),c(0,height), col=col, lty=lty) + } return (ts); }