Re: [R] Sweave and multipage lattice

From: Sundar Dorai-Raj <sundar.dorai-raj_at_pdf.com>
Date: Thu 20 Jul 2006 - 02:01:02 EST

Dieter Menne wrote:
> Dear R-Listeners,
>
> as the Sweave faq says:
>
> http://www.ci.tuwien.ac.at/~leisch/Sweave/FAQ.html
>
> creating several figures from one figure chunk does not work, and for
> standard graphics, a workaround is given. Now I have a multipage trellis
> plot with an a-priori unknown number of pages, and I don't see an elegant
> way of dividing it up into multiple pdf-files.
>
> I noted there is a "page" event handler in the ... parameters, which would
> provide a handle to open/close the file.
>
> Any good idea would be appreciated.
>
> Dieter
>

Hi, Dieter,

I haven't seen a reply to this and I don't know Sweave. However, will the following example work? It does require you know the layout for one page.

--sundar

library(lattice)

trellis.device(postscript, file = "barley%02d.eps",

                width = 5, height = 3, onefile = FALSE,
                paper = "special")

## from ?xyplot
dotplot(variety ~ yield | site, data = barley, groups = year,
         key = simpleKey(levels(barley$year), space = "right"),
         xlab = "Barley Yield (bushels/acre) ",
         aspect=0.5, layout = c(1, 1), ylab=NULL)
dev.off()

files <- list.files(pattern = glob2rx("barley*.eps")) for(file in files)

   cat("\\includegraphics{", file, "}\n\n", sep="")



R-help@stat.math.ethz.ch 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 Thu Jul 20 02:18:54 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Thu 20 Jul 2006 - 18:17:48 EST.

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