It is helpful if you provide your example data in a format that is easy for R-help readers to reproduce, for example, using the dput() function. For example,
dat <- structure(list(Date = c("1/1/2013", "1/2/2013", "1/3/2013", "1/4/2013", "1/5/2013", "1/6/2013", "1/7/2013", "1/8/2013", "1/9/2013", "1/10/2013", "1/11/2013", "1/12/2013", "1/13/2013", "1/14/2013", "1/15/2013", "1/16/2013", "1/17/2013", "1/18/2013", "1/19/2013", "1/20/2013", "1/21/2013", "1/22/2013", "1/23/2013", "1/24/2013", "1/25/2013", "1/26/2013", "1/27/2013", "1/28/2013", "1/29/2013", "1/30/2013", "1/31/2013"), day = c("Tue", "Wed", "Thu", "Fri", "Sat", "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun", "Mon", "Tue", "Wed", "Thu"), Var1 = c(2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L), Var2 = c(3, 3, 4, 4, 4.5, 4.9, 5.3, 5.7, 6.1, 6.5, 6.9, 7.3, 7.7, 8.1, 8.5, 8.9, 9.3, 9.7, 10.1, 10.5, 10.9, 11.3, 11.7, 12.1, 12.5, 12.9, 13.3, 13.7, 14.1, 14.5, 14.9), Var3 = 4:34, Obs = 1:31), .Names = c("Date", "day", "Var1", "Var2", "Var3", "Obs"), class = "data.frame", row.names = c(NA, -31L)) Reduce the mar argument settings in the par() function to reduce the space between plots, and use the oma argument to increase the space at the bottom of the page. You could use a for() loop to add vertical lines separately to each plot. Not quite what you had asked for, but very easy to implement. par(mar=c(0.5, 5, 0.5, 0.5), oma=c(8, 0, 0, 0), mfrow=c(3, 1)) for(i in 1:3) { colm <- match(paste0("Var", i), names(dat)) plot(dat[, colm] ~ Obs, data=dat, xaxt="n", xlab="", ylab=paste0("Var", i)) abline(v=dat$Obs[dat$day %in% "Sat"]-0.5, lty=2, lwd=3, col="gray") abline(v=dat$Obs[dat$day %in% "Sun"]+0.5, lty=2, lwd=3, col="gray") } axis(1,at=dat$Obs,label=dat$Date) mtext(1,text="Date",line=2.5) axis(1,at=dat$Obs,label=dat$day,line=4) mtext(1,text="Day of week",line=7) Jean On Thu, Jun 6, 2013 at 12:43 AM, Ye Lin <ye...@lbl.gov> wrote: > Hey All, > > I have a dataset like this: > > DatedayVar1Var2Var3Obs1/1/2013Tue23411/2/2013Wed23521/3/2013Thu24631/4/2013 > > Fri24741/5/2013Sat24.5851/6/2013Sun24.9961/7/2013Mon25.31071/8/2013Tue25.711 > 81/9/2013Wed26.11291/10/2013Thu26.513101/11/2013Fri26.914111/12/2013Sat27.3 > > 15121/13/2013Sun27.716131/14/2013Mon28.117141/15/2013Tue28.518151/16/2013Wed > 28.919161/17/2013Thu29.320171/18/2013Fri29.721181/19/2013Sat210.12219 > > 1/20/2013Sun210.523201/21/2013Mon210.924211/22/2013Tue211.325221/23/2013Wed2 > 11.726231/24/2013Thu212.127241/25/2013Fri212.528251/26/2013Sat212.92926 > > 1/27/2013Sun213.330271/28/2013Mon213.731281/29/2013Tue214.132291/30/2013Wed2 > 14.533301/31/2013Thu214.93431 > Here is the code I use to plot: > > par(mar=c(10, 0.5, 0.5, 0.5)) > par(mfrow=c(3,1)) > plot(Var1~Obs,data=dat,xaxt="n",xlab="") > plot(Var2~Obs,data=dat,xaxt="n",xlab="") > plot(Var3~Obs,data=dat,xaxt="n",xlab="") > axis(1,at=dat$Obs,label=dat$Date) > mtext(1,text="Date",line=2.5) > axis(1,at=dat$Obs,label=dat$day,line=4) > mtext(1,text="Day of week",line=7) > > How can I remove the extra white space between plots and emphasize time > periods=weekend with dashed area?? I have attached original output and > ideal output I am looking for. > > Any suggestion to emphasize/highlight weekend periods is really appreciate! > > Thanks! > > ______________________________________________ > 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. > > [[alternative HTML version deleted]] ______________________________________________ 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.