Re: [R] R plots pdf() does not allow spotcolors?

From: Barry Rowlingson <>
Date: Wed, 13 Apr 2011 17:26:57 +0100

2011/4/13 Matthieu Stigler <>:
> Jim
> Thanks for your feedback! The problem is that the people "those responsible
> for layout" are us... We are doing the book in Latex, and till now did not
> need any other software.
> But I am scared we will need use kind of Indesign & co softwares to be able
> to use our R plots, since R can't export into spotcolor...

 I've just had a look into how PostScript handles spot colours, having been hacking PS files for many years its not something I'd played with before.

 This page gave me a PS file that used spot colours:

and it seems that you can set a colour using a colour space array:

    [ /Separation (PANTONE Violet C)
  /DeviceCMYK { dup 0.750000 mul exch dup 0.940000 mul exch dup 0.000000 mul exch 0.000000 mul }

    ] setcolorspace 1.00 setcolor

Now, my screen previewer has no idea what colour PANTONE Violet C is, so there's an alternative CMYK colour space version. In fact PANTONE Violet C is just a label. The idea is that when processed for colour separations the software will use the separation colours.

Now, to get this into R is tricky. Either you have to rewrite the PS driver or hack the PS output file. I produced a simple R plot with one purple (col="#FF00FF") blob and saved to a PS file. The bit of the PS that set the colour was this:

 /bg { 1 0 1 rgb } def
 1 0 1 rgb

 To specify this as a spot colour (with a CMYK alternative for preview), I changed that to this:

/pvc {

    [ /Separation (PANTONE Violet C)
  /DeviceCMYK { dup 0.750000 mul exch dup 0.940000 mul exch dup 0.000000 mul exch 0.000000 mul }

    ] setcolorspace
} def

/bg {
pvc 1.00 setcolor
} def
pvc 1.00 setcolor

Now if you only have one or two spot colours and only a few places where they occur then it might be possible for you to do this kind of edit/replacement - either manually or automatically. And beware I'm not even sure this is right or that your publisher would be happy anyway.

 Anyway, thats enough PS hacking for one day.

Barry mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Wed 13 Apr 2011 - 16:30:36 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 13 Apr 2011 - 20:00:29 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive