[R] R plots pdf() does not allow spotcolors?
Ben Bolker
bbolker at gmail.com
Wed Apr 13 15:52:49 CEST 2011
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.
More information about the R-help
mailing list