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.
I'm sure that I have broken a few of the rules for submission as far as: - new features should have more than one user advocate I don't know that masses of people will find this an extraordinarily exciting feature. I know I use it, and one other guy seemed interested. - don't modify defaults or regression tests Layers are not valid in versions of pdf previous to 1.5. The default output version in pdf() was 1.4 - I bumped it up to 1.5 so that when the user just pdf("file/name.pdf", onepage=TRUE) they wouldn't get any warnings or anything unexpected. This causes the reg-plot and reg-plot-latin1 tests to highlight the version numbers in the output files as conflicting, so I quieted this by adding version="1.4" to reg-plot.R and reg-plot-latin1.R . I also added an argument entry to pdf.Rd I've seen Prof Ripley's argument that: >> Is it possible to create a pdf file with layers using the pdf() device in R? >No. Is it possible to specify layers in the R graphics language or any >device? (From what I understand by 'layers', no.) Different formats have disparate [features / attributes] and it is because people find value in the differences that so many formats are maintained. An interesting feature of the PDF specification is Optional Content Groups, (ie layers) so why can't we use them? It makes post-processing figures infinitely easier. Also the package 'latticeExtra' allows a 'layer-like' ability to stack plots by concatenating them plot()+plot(), so I think layers in pdf() is an interesting feature. I thought about adding the feature as an extension, but I couldn't determine a way to do it without duplicating most of the functionality of pdf(). I modified only the essential. I'm not optimistic that it will be [accepted / applied], but I've already done all the work and figured I'd finish it by showing it to the people here. thanks for your time, ejb [[alternative HTML version deleted]] ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel