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

mat matthieu.stigler at gmail.com
Wed Apr 13 21:46:46 CEST 2011


Barry, thanks a lot for checking for this!! Find below answers.

Le 13. 04. 11 18:26, Barry Rowlingson a écrit :
> 2011/4/13 Matthieu Stigler<matthieu.stigler at gmail.com>:
>> 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:
>
> http://pslib.sourceforge.net/examples.php
>
> 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
>
I do no get something similar... I used:
set.seed(123)

a<-runif(100)

postscript("RplotRGB.ps", colormodel="rgb")
plot(a, col="#FF00FF")
dev.off()

Interestingly, I compared with:
postscript("RplotCMYK.ps", colormodel="cmyk")
plot(a, col="#FF00FF")
dev.off()

and making a diff, I see only:
87c87,88
< 1 0 1 rgb
---
 > 0 1 0 0 setcmykcolor
 >
194c195,196
< 0 setgray
---
 > 0 0 0 1 setcmykcolor
 >
278c280,281
< 0 setgray
---
 > 0 0 0 1 setcmykcolor
 >
does not look so similar to what you obtained...

>   - the two settings here are for the outline and fill of the blob,
> which was created using pch=19.
>
may I ask you what are outline and fill?
>   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.
>
no but seems quite a nice solution, as I have only known cmyk colors (5) 
for which I can find Pentone matching. Could setup small script then! 
Just need to figure out why we do not get similar results you and me!!

Thanks so much!!


>   Anyway, thats enough PS hacking for one day.
>
> Barry



More information about the R-help mailing list