PDF graphics -- color weirdness (PR#2281)

jenny@stat.ubc.ca jenny@stat.ubc.ca
Mon, 11 Nov 2002 20:49:58 +0100 (MET)

Full_Name: Jenny Bryan
Version: 1.4.1
OS: Linux + Windows 2000
Submission from: (NULL) (

I'm using R 1.4.1 to make PDF graphics in a Linux environment.  I then include
them in a LaTeX document that I'm actually typesetting in Windows.  I don't
think the OSes have anything to do with this.

I use the foils documentclass, pdflatex to typeset, ppower4 to postprocess the
pdf file to get some nice features.  Once again, I don't think any of this is
the root of the problem.

It seems that the way R specifies colors for PDF figure elements and text has
quite a bit of diversity in it, but you'd never notice it until you putthese
PDFs onto a dark blue background in a document where "yellow" is the default
document foreground color.

What I've found is that, when the default page color is not white -- such as
when it's dark blue, as is typical for laptop presentations -- the colors in an
included pdf file generate by R can have some unexpected behavior.

I've created a pdf "talk" that is the best way to demonstrate this.  I'd be
pleased to send it to whomever might look into this.

But here's the short version:
Some objects appear to take their color not in an absolute way (as in "black"),
but relative to the current document context (as in some notion of the 'default
color' at this moment.  Which objects do this is pretty unpredictable.  Behavior
also seems to depend on current value of "par("bg").

As far as I can tell, objects in the figure break into three categories:

1) Appear as the color of "fg" (i.e. black) NO MATTER WHAT.  In my small
examples, only seems to happen for the tick mark labels produced by "axis()".

2) Appear as the current notion of the document's default color.  Happens for
figure box, plot points, and axis tick marks produced by "plot()".

3) Affected by the color of "bg".  If "bg = transparent", then these appear in
"fg" color.  If "bg = <somecolor>", then these appear in the current notion of
document default color.

r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch