[R] One main caption for an mfrow=c(2,1) plot window
Alexander Engelhardt
alex at chaotic-neutral.de
Sun May 29 22:52:21 CEST 2011
Hello,
I'm trying to plot a series of pages in a pdf with one main caption for
each page.
Each page should then have two plots in one row, preferably with an own
caption.
I can't plot the main caption in a window, and subsequently plot the two
graphics (next to each other) below it.
Here is what I've tried. This one almost does the job, but when plotting
the two graphics, R generates a new pdf page.
The 3 commented lines were another approach I tried but didn't work out.
The split.screen() erases what was previously drawn on the device (which
is the main caption in my case):
x <- 1:10
y <- 10:1
pdf("sandbox.pdf", width=6.5, height=3)
for(i in 1:3){
plot.new()
title("derp")
op <- par(mfrow=c(1,2))
# split.screen(c(1,2))
plot(x)
# screen(2)
plot(y)
# close.screen(c(1,2))
par(op)
}
dev.off()
Any ideas?
Thanks in advance,
Alex
More information about the R-help
mailing list