pp.timelinefill <- function (x, type="l", log="y", fillcol="blue", main="", ...) { ## simple-minded function to plot time series ## with filling using a line connecting start and end ## placed in the public domain by Burns Statistics 2011 ## if(inherits(x, "zoo")) { plot(x, type=type, log=log, main=main, ...) px <- c(index(x), index(x)[1]) py <- c(as.vector(x), as.vector(x)[1]) polygon(px, py, col=fillcol) } else { stop("not implemented for objects that are not 'xts' or 'zoo'") } }