ok, solved it. Hoowever (there is always a however), I would like to centre the line plot of the rolling mean onto the centre of each bar in my bar plot. Currently, the lines aligns itself with the RHS of bars.
I have tried this http://n4.nabble.com/Barplot-plot-same-scale-td1009254.html#a1009269 but it does not work. It draws the line on, but the line is stretched, and does not fit my rainfall data at all as it extends outside the RHS of the barplot. kent2<-zoo(kent) kent2<-rollapply(kent,11,mean,align=c("center")) mp<-barplot(c(kent2)) #kent 2 is the matrix of the rolling mean data barplot(Ann,main=title, xlab="Year",ylab="Rainfall (mm)", ylim=c(0,ymax),col="blue",space=0) lines(c(kent2),lwd=2) # I have drawn it twice just to see the difference lines(mp,c(kent2),lwd=2,col="red") -- View this message in context: http://n4.nabble.com/prompts-and-running-means-tp1475403p1478096.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.