# [R] postscript()

Peter B. Mandeville mandevip at uaslp.mx
Tue Jul 11 10:22:43 CEST 2000

I am using RedHat 6.1, the R1.1.0 binary download, and an HP Deskjet 692C.
For some time I have been trying unsuccessfully to integrate R postscript
graphics in LaTex. I consulted the Bug Tracking System.

In the preamble of the LaTex file (test.tex) I have placed the line

\usepackage{graphicx,color}

and I use

\begin{figure}[htbp]
\begin{center}
\includegraphics[height=4in]{graphic1.ps}
\caption{boxplot}
\end{center}
\end{figure}

to include the graphic in the document. Using the command

xdvi test

I can preview the document and the graph is shown. I use

dvips test.dvi

to print the document. This arrangement works perfectly with poscript
graphics produced by gimp but the printer hangs at the beginning of the
graphic when I use graphics generated by the postscript command in R.

An example postscript graph is produced in R by

yield <-
c(96,37,58,69,73,81,93,81,79,101,96,102,60,54,78,56,61,69,76,89,88,84,75,68)
variety <- factor(c(rep("I",6),rep("II",6),rep("III",6),rep("IV",6)))
data <- data.frame(variety,yield)
postscript("graphic1.ps",horizontal=F)
boxplot(yield~variety,xlab="Variety",ylab="Yield (bushels per acre)")
dev.off()

It should be noted that I have tried many postscript graphics files
generated in R with the same results. I have also checked the help page and
section 12.6.1 PostScript Diagrams for typeset documents (page 77) in An
Introduction to R and Lipkin's LaTex for Linux.

The Usage portion of the help page appears to be in error as it has an
unmatched comma in the first line?

I have also tried using the line

postscript("graphic1.ps",horizontal=F,onefile=F)

with the same results.

However, I can read the graphic with gimp and if I save the file as an
encapsulated postscript file from gimp then the above procedure works. The
R document is 4,837 bytes in length and the gimp document is 5,289,399
bytes in length.

What am I doing wrong?

Peter B.

--
Peter B. Mandeville                             mandevip at deimos.tc.uaslp.mx
Jefe del Depto. de Informática y Bioestadística rpe1531 at pasteur.fmed.uaslp.mx
Facultad de Medicine                            Tel: 48 26-23-45 ext. 232
Universidad Autónoma de San Luis Potosí         Fax: 48 28-23-52
Av. V. Carranza 2405
Col. Los Filtros