[R] Printing ps pictures with transparent b'ground

Peter Dunn dunn at usq.edu.au
Thu May 6 06:54:33 CEST 2004


Hi all

I wish to create a ps file of a picture produced in R.
With my limited R, I see two ways:
1. Print direct to the postscript device
2. Print to the screen, and save to ps using dev.print.

I want a white (not transparent) background.  Option
1 above works fine, but 2 does not:  even when I say I
want a white background, I get transparent; perhaps I
misread the help files.

Here's some R code:

### Method 1
### - print straight to postscript device
postscript(horizontal=FALSE,
	onefile=FALSE,
	bg="white",
	width=4,
	height=4,
	paper="special",
    file="testfile.eps" )
curve( dnorm, from=-3, to=3)

dev.off()

### Method 2
### - print to screen, and save using  postscript

x11(width=4, height=4)
curve( dnorm, from=-3, to=3)

dev.print( postscript,
    horizontal=FALSE,
	onefile=FALSE,
	bg="white",
	width=4,
	height=4,
	paper="special",
    file="testfile2.eps" )


I then want to place these files in a LaTeX prosper document
for a presentation.  A typical (minimal) prosper file is:

\documentclass[pdf,colorBG,slideColor,whitecross]{prosper}

\begin{document}

\begin{slide}{Print to \textsc{ps} direct}
\includegraphics{testfile.eps}
\end{slide}

\begin{slide}{Print to screen first}
\includegraphics{testfile2.eps}
\end{slide}

\end{document}


The  whitecross  class provides a blue background for the
presentation.  testfile.eps  appears with a white background
on the slides, but  testfile2.eps  has a transparent
background.

I'd apprecaite if someone could explain why the two are not equivalent,
or how I can coerce the second option to have a white background?  Or
even explain my misunderstandings (assuming (with high probability)
that I have some).

Thanks.

P.

 > version
          _
platform i686-pc-linux-gnu
arch     i686
os       linux-gnu
system   i686, linux-gnu
status
major    1
minor    8.1
year     2003
month    11
day      21
language R



-- 
Dr Peter Dunn          (USQ CRICOS No. 00244B)
   Web:    http://www.sci.usq.edu.au/staff/dunn
   Email:  dunn @ usq.edu.au
Opinions expressed are mine, not those of USQ.  Obviously...




More information about the R-help mailing list