Hi We are about to publish a book, which contains figures made with R plots. An important detail that we did not take into account is that the book will not be printed in 4 colors (cmyk mode), but only 2 (black +"spotcolor"). The spotcolor we use is part of the big Pantone family. The problem is that both pdf() and postscript() offer either rgb or cmyk, but no spotcolors such as pantone. I'm afraid this constraint can't be solved at all, and we can't use R for creating these plots? I did not find any package that would extend the colormodel to include spot colors... Did anyone had a similar experience? Thanks!! Matthieu
R plots pdf() does not allow spotcolors?
7 messages · Matthieu Stigler, (Ted Harding), Brian Ripley +3 more
Matthieu Stigler <matthieu.stigler <at> gmail.com> writes:
Hi We are about to publish a book, which contains figures made with R plots. An important detail that we did not take into account is that the book will not be printed in 4 colors (cmyk mode), but only 2 (black +"spotcolor"). The spotcolor we use is part of the big Pantone family. The problem is that both pdf() and postscript() offer either rgb or cmyk, but no spotcolors such as pantone. I'm afraid this constraint can't be solved at all, and we can't use R for creating these plots? I did not find any package that would extend the colormodel to include spot colors... Did anyone had a similar experience?
Wasn't aware of spotcolors, but I bet you could hack the PDF reasonably easily (if you have many figures you might have to use awk/sed/perl ?) ... if you don't use R, what is your alternative for creating the figures? Ben Bolker
On 13-Apr-11 12:30:26, Ben Bolker wrote:
Matthieu Stigler <matthieu.stigler <at> gmail.com> writes:
Hi We are about to publish a book, which contains figures made with R plots. An important detail that we did not take into account is that the book will not be printed in 4 colors (cmyk mode), but only 2 (black +"spotcolor"). The spotcolor we use is part of the big Pantone family. The problem is that both pdf() and postscript() offer either rgb or cmyk, but no spotcolors such as pantone. I'm afraid this constraint can't be solved at all, and we can't use R for creating these plots? I did not find any package that would extend the colormodel to include spot colors... Did anyone had a similar experience?
Wasn't aware of spotcolors, but I bet you could hack the PDF reasonably easily (if you have many figures you might have to use awk/sed/perl ?) ... if you don't use R, what is your alternative for creating the figures? Ben Bolker
Don't expect to hack PDF "reasonably easily" -- for many reasons, one of which is that in PDF different bits of a document can be (and usually are) encapsulated in PDF "objects", whose physical location in the PDF file can be pretty random (there is a kind of "hash index" at the beginning which points to them). So a PDF file can be heavily fragmented (as also can a PS file, though usually not nearly so heavily). In theory it would be possible for every single character in a textual document to be in a separate "PDF object" and located in random order in the file! As a general comment (which unfortunately doesn't address the main problem raised by Matthieu), it can often be better to use independent software to create figures/diagrams based on numerical results computed by R. R's plots are quite nicely done by default, but tweaking them to achieve a preferred layout in R itself can be painfully time-consuming. Myself, I farm this out to the 'pic' preprocessor in troff/groff, using which any details whatever can be arranged exactly to one's taste. Since spotcolour printing is a multi-pass procedure, one can prepare the separate "layers" in the respective colours, along with any necessary crop-marks or "bulls-eyes", quite easily. However, this too generates PS output in the first instance (convertible to PDF of course), so suffers the same "binding" to the RGB/CMYK colour paradigm. So Pantone would not be available in the first instance (except insofar as a subset of the Pantone "spectrum" corresponds to colours in CMYK). However, I presume it is highly likely that there is software which can take a file (PS or PDF) prepared using RGB/CMYK, and convert this to a Pantone-compatible file. Even so, this would depend on what your publisher/printer requires in what you submit. It would be important to obtain from them a full and exact specification of what they require for colour printing in files submitted to them for printing. Hoping this is of some help ... Ted. -------------------------------------------------------------------- E-Mail: (Ted Harding) <ted.harding at wlandres.net> Fax-to-email: +44 (0)870 094 0861 Date: 13-Apr-11 Time: 14:17:56 ------------------------------ XFMail ------------------------------
On Wed, 13 Apr 2011, Ben Bolker wrote:
Matthieu Stigler <matthieu.stigler <at> gmail.com> writes:
Hi We are about to publish a book, which contains figures made with R plots. An important detail that we did not take into account is that the book will not be printed in 4 colors (cmyk mode), but only 2 (black +"spotcolor"). The spotcolor we use is part of the big Pantone family. The problem is that both pdf() and postscript() offer either rgb or cmyk, but no spotcolors such as pantone.
Well, how could it? R's colour model is sRGB, and it has not other way to refer to colours. The colour model is not at the level of a package ....
I'm afraid this constraint can't be solved at all, and we can't use R for creating these plots? I did not find any package that would extend the colormodel to include spot colors... Did anyone had a similar experience?
Wasn't aware of spotcolors, but I bet you could hack the PDF reasonably easily (if you have many figures you might have to use awk/sed/perl ?) ... if you don't use R, what is your alternative for creating the figures?
No, PDF is not a text format and not easy to hack. It has a binary index of byte positions so you edit it at your peril. However, this is exactly what professionals have PDF editing tools for. I believe I used Acrobat (not Reader) to do it when I needed to for my books.
Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
Prof Brian Ripley <ripley <at> stats.ox.ac.uk> writes:
On Wed, 13 Apr 2011, Ben Bolker wrote:
Matthieu Stigler <matthieu.stigler <at> gmail.com> writes:
Hi We are about to publish a book, which contains figures made with R plots. An important detail that we did not take into account is that the book will not be printed in 4 colors (cmyk mode), but only 2 (black +"spotcolor"). The spotcolor we use is part of the big Pantone family. The problem is that both pdf() and postscript() offer either rgb or cmyk, but no spotcolors such as pantone.
Well, how could it? R's colour model is sRGB, and it has not other way to refer to colours. The colour model is not at the level of a package ....
I'm afraid this constraint can't be solved at all, and we can't use R for creating these plots? I did not find any package that would extend the colormodel to include spot colors... Did anyone had a similar experience?
Wasn't aware of spotcolors, but I bet you could hack the PDF reasonably easily (if you have many figures you might have to use awk/sed/perl ?) ... if you don't use R, what is your alternative for creating the figures?
No, PDF is not a text format and not easy to hack. It has a binary index of byte positions so you edit it at your peril. However, this is exactly what professionals have PDF editing tools for. I believe I used Acrobat (not Reader) to do it when I needed to for my books.
OK. I was misremembering the good old days when I used to hack
the PostScript coming out of gnuplot. I must admit that when I look
at PDFs coming out of R, as in
pdf("test.pdf")
plot(1:10,1:10,pch=16,col=rep(1:5,2),cex=2)
dev.off()
I still see text-like bits like
/sRGB cs 0.000 0.804 0.000 scn
that are clearly (by experiment) hackable.
That doesn't mean it's easy or a good idea in practice.
Re Ted's comment that it's better to compute in R and draw
figures outside: that really depends on one's comfort level with
various tools and the tradeoffs between (1) command-line
control and reproducibility (2) the ability to do subtle visual
design adjustments by hand.
Even so, this would depend on what your publisher/printer requires in what you submit. It would be important to obtain from them a full and exact specification of what they require for colour printing in files submitted to them for printing.
No one else has mentioned this, but the publisher is trying to make money, not make your life easier. Sometimes the right thing to do is say "Hey - you guys are the experts at this, you convert my RGB pdfs to the correct format". It's worthwhile to push back a bit to publishers and get them to do their job. Hadley
Assistant Professor / Dobelman Family Junior Chair Department of Statistics / Rice University http://had.co.nz/
Hi, I may be wrong, but I have the impression that tikz (a LaTeX drawing package) can handle spot colors (that's what Google seemed to tell me [*]). If this is the case you could output R graphics using the tikzDevice package, post-process the output (readable, plain text file), and eventually have LaTeX produce the pdf image with spot colors. Worth a try, perhaps. baptiste [*] http://wiki.contextgarden.net/Colors#In_TikZ
On 13 April 2011 21:15, Matthieu Stigler <matthieu.stigler at gmail.com> wrote:
Hi We are about to publish a book, which contains figures made with R plots. An important detail that we did not take into account is that the book will not be printed in 4 colors (cmyk mode), but only 2 (black +"spotcolor"). The spotcolor we use is part of the big Pantone family. The problem is that both pdf() and postscript() offer either rgb or cmyk, but no spotcolors such as pantone. I'm afraid this constraint can't be solved at all, and we can't use R for creating these plots? I did not find any package that would extend the colormodel to include spot colors... Did anyone had a similar experience? Thanks!! Matthieu
______________________________________________ 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.