Re: [R] One main caption for an mfrow=c(2,1) plot window

From: Uwe Ligges <ligges_at_statistik.tu-dortmund.de>
Date: Mon, 30 May 2011 10:39:36 +0200

On 29.05.2011 22:52, Alexander Engelhardt wrote:
> 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)

forget the rest and use outer margins as in:

par(mfrow = c(1, 2), oma = c(0, 0, 2, 0)) for(i in 1:3){
  plot(x)
  plot(y)
  title(outer = "derp")
}

dev.off()

Uwe Ligges

> 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
>
> ______________________________________________
> R-help_at_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_at_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. Received on Mon 30 May 2011 - 08:43:04 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

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 Mon 30 May 2011 - 09:40:11 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