[R] Multiple Plots and y Axis Labels
jonboym
jonboym2 at yahoo.co.uk
Tue Jul 8 13:43:05 CEST 2008
Hi,
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)
fire<-ts(scan("fire.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,
cex=mtex);
par(op)
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.
More information about the R-help
mailing list