[Rd] (patch) Layers for pdf() grDevice

Ben Bolker bbolker at gmail.com
Sat Jan 26 21:05:38 CET 2013

Evan J Brunner <ejbrunner <at> gmail.com> writes:

> I built a patch (
> https://github.com/3jb/R_layers/blob/master/add_pdf_layers_r61733.diff)
> for grDevice/devPS.c adding an argument 'onepage' to pdf(), if set to
> TRUE, successive plots will be printed to layers within a single pdf
> document page rather than successive documents, or successive pages within
> a document.  The patch works on the HEAD of the current svn development
> tree.

  Lots of context snipped, sorry (using gmane).

  This is a pretty ignorant question because I haven't delved very deeply
into graphics coding in R, but: how much harder would it be for you to
incorporated this code into a driver for an alternative graphics device
(call it "pdfx")?  Then you could put it in a package and release it on CRAN.

 * it would be (much) easier to distribute to people who wanted it -- they
could just install a package rather than rebuilding R.
 * R core wouldn't have to agree or disagree as long as you follow the
package submission rules.
 * if it gets popular it might eventually migrate into base R.

 I can also imagine that the cairoDevice maintainers might be interested/willing
to incorporate your patch or one like it.

library("sos"); findFn("{graphics device} driver")

finds packages incorporating alternative graphics devices.

  Ben Bolker

More information about the R-devel mailing list