Skip to content

R plots pdf() does not allow spotcolors?

6 messages · Matthieu Stigler, Barry Rowlingson, Jeremy Hetzel

#
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...

Thanks!

Mat





Le 13/04/2011 13:41, Jim Lemon a ?crit :
#
2011/4/13 Matthieu Stigler <matthieu.stigler at gmail.com>:
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

 - the two settings here are for the outline and fill of the blob,
which was created using pch=19.

 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
#
On Wed, Apr 13, 2011 at 5:26 PM, Jeremy Hetzel <jthetzel at gmail.com> wrote:
Scribus can import output from R's svg driver (with at least some
degree of success).

 I just imported a simple plot to Scribus, specified some spot
colours, and saved as EPS - the colours were specified as /Separation
colours as described in my earlier message.

 I did try inkscape for this, but forgot about scribus. Inkscape
doesnt seem to have such colour management.

Barry
#
By the way, I had trouble importing PDFs into Scribus 1.3.3.  However, 
Scribus 1.4.0rc3 had no problem opening multi-page PDFs, assuming the 
appropriate Ghostscript was also installed (I'm on Windows 7 at the moment). 
 So Matthieu might be able to combine all of his figures into a single PDF, 
convert to spot color in Scribus, then break the PDF apart again for Latex.

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

Le 13. 04. 11 18:26, Barry Rowlingson a ?crit :
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...
may I ask you what are outline and fill?
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!!