s-news
[Top] [All Lists]

pdf.graph ignores my image colors

To: s-news@lists.biostat.wustl.edu
Subject: pdf.graph ignores my image colors
From: Kevin Wright <kwright@eskimo.com>
Date: Mon, 27 Oct 2003 06:35:17 -0800 (PST)
I'm using S-Plus 6.1 on Windows 2000.

I have set my trellis image colors to be a different palette 
than the usual cyan->magenta.

When I use trellis.device to create a plot (on the video monitor)
that uses image colors (like levelplot), my color settings are 
honored.

When I use trellis.device(pdf.graph,...) to send the same graphic
to a PDF file, my color settings are ignored and the default 
cyan->magenta colors are used.

After way too much work, I have achieved a partial work-around:

1. Used guiGetOption("ImageColorTableTrellis") to get the 
rgb codes for my trellis image colors (three colors: red, 
white, green).

2. Go to R and use 'rainbow', 'col2rgb', etc.  Create a palette 
of 100 colors.  Scale these to be in [0, 1].  
Call this 'mycolormatrix'.

3. Copy pdf.trellis.color=pdf.trellis.color

4. Set: pdf.trellis.color$colormap[17:116,]=mycolormatrix

5. Now call trellis.device(pdf.graph,...) and make the graphics.

My question is: Have I made this unnecessarily complicated?  
Is there an easier way to make S-Plus honor the user's trellis 
image colors?  At the very least, are there any S-Plus tools 
for making a rainbow of 100 colors using the 
ImageColorTableTrellis colors?

Kevin Wright

<Prev in Thread] Current Thread [Next in Thread>