On Thu, Jun 6, 2013 at 6: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.
Take a look at my "xtsExtra" package off of R-forge: ## Using your data as Jean arranged it. library(xtsExtra) dat2 <- xts(dat[,c(3,4,5)], as.Date(dat[,1], format = "%m/%d/%Y")) plot(dat2, yax.loc = "left") and look at example(plot.xts) for how to do shading / lines as desired. Cheers, MW > > 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. > ______________________________________________ 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.