In addition to the great answers already given, you can equalize the vertical part of each plot by having all the plots have the same margins, but creating an outer margin for the common x-axis.
do something like: par(mar=c(0,4,0,2), oma=c(4,0,0,0)) then don't change the margins before the last plot, there will be room below the bottom plot for the x-axis information to go into (or you could place it there using the axis function and the outer argument) and the figure regions will all be the same size after giving room for the outer margin, and since the inner margins all match (did not change) they will give the same vertical space to each plot. On Thu, Feb 27, 2014 at 5:19 PM, David Parkhurst <parkh...@imap.iu.edu> wrote: > I would like to plot three graphs, one above the other, of three "y" > variables that have different scales against a common Date variable, as with > the code below. > > Q1. If I understand correctly, I can't use lattice graphics because my y's > have different scales. Is that correct? All the lattice or trellis plots > I've seen have common "y" scales for all plots. > > I have two problems with what this code produces: > Q2. How can I get the vertical dimension of all three plots to be the same? > I know that I've made them different by using different mar numbers, but I > had to do that, I thought, to leave room for date axis labels. I don't want > to leave wasted space between the plots. > > Q3. Why are my dates not coming out in the format I've specified in the > axis.Date statement? > > DateNum <- seq(8248,9247) > Date<-as.Date(DateNum, origin="1970/01/01") > y1<- runif(1000,0,1) > y2<- runif(1000,0,100) > y3<- runif(1000,0,10) > par(mfrow=c(4,1)) > par(mar=c(0,4,0,2)+0.1) > plot(y1 ~ Date, xaxt = "n", type = "p",cex=0.7) > plot(y2 ~ Date, xaxt = "n", type = "p",cex=0.7) > par(mar=c(4,4,0,2)+0.1) > plot(y3 ~ Date, xaxt = "n", type = "p",cex=0.7) > DateLbls <- > seq.Date(from=as.Date("1992/08/01"),to=as.Date("1995/04/27"),by="3 months") > axis.Date(side=1,Date,at=DateLbls, labels=DateLbls, format="%m-%y") > > ______________________________________________ > 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. -- Gregory (Greg) L. Snow Ph.D. 538...@gmail.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.