[R] Multiple Plots and y Axis Labels

From: jonboym <jonboym2_at_yahoo.co.uk>
Date: Tue, 08 Jul 2008 04:43:05 -0700 (PDT)


I'm using the mfrow parameter in par() to plot several timeseries with a common time x axis as a sequence of plots one below the other. I reduced the top and bottom margins to zero to get a very nice looking plot but sometimes the labels on the y axes from one plot overlap with the y axis labels on the plot above or below.

Any ideas how I can prevent this without losing the look of the plots? ie I don't want gaps between the plots. Below is some example code.

        rain<-ts(scan("rain.csv"),start=1996, frequency=12)

	op<-par(mar=c(0,0,0,0), oma=c(2,5,3,1), mfrow=c(2,1))
	xl <- c(1996,2008)

	plot(rain, xlim=xl, axes=F, col="blue"); 
	axis(2, las=1); axis(1, labels=F); box(); 
	abline(v=1996:2008, lty=3)

	mtext("Rainfall",   side=2, line=line1, cex=mtex);
	mtext(expression(paste("mm ",month^{-1})), side=2, line=line2, cex=mtex);
	plot(fire*100, xlim=xl, axes=F, col="red"); 
	axis(2, las=1); axis(1, labels=F); box(); 
	abline(v=1996:2008, lty=3)
	mtext("Fire", side=2, line=line1, cex=mtex);
	mtext(expression(paste("% Area Burned ",month^{-1})), side=2, line=line2,
	mtext(plottitle, line=3, font=2, cex=1.5)

View this message in context: http://www.nabble.com/Multiple-Plots-and-y-Axis-Labels-tp18337207p18337207.html
Sent from the R help mailing list archive at Nabble.com.

R-help_at_r-project.org mailing list
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Tue 08 Jul 2008 - 11:46:16 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 08 Jul 2008 - 12:31:40 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive