Skip to content

postscript()

5 messages · Peter B. Mandeville, Brian Ripley, Ross Ihaka +2 more

#
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
Apartado Postal 145
San Luis Potos?, S.L.P.
78210 M?xico

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help 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-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
On Tue, 11 Jul 2000, Peter B. Mandeville wrote:

            
How do you get postscript files to an HP Deskjet 692C, which is not a
postscript printer AFAIK?  It looks to me as if that stage has a bug.
There are lots of dvips options that can be set in configuration files.
Try -K here, to pull comments from the included file.
The help page suggests horizontal=FALSE, onefile=FALSE, paper="special".
to produce plots for inclusion in LaTeX.  You might find it easier to plot
on screen and use dev.copy2eps().
Um, but you did not do what the help page suggested.
An un-escaped `%' in fact. Thanks, now fixed.
That's made a bitmap.
Perhaps nothing. Your example works on RH6.2 with an actual postscript
printer and the latest teTeX.  My guess is that whatever you are using for
converting the file to PCL to print on your printer has a problem.
This is not implausible, as we have found ghostscript (prior to 6.01,
especially prior to 5.50) unreliable when driving an HP Deskjet 895Cxi.

You may be able to help the process by including a file marked as EPSF
(as suggested on the help page) and by removing comments.
#
On Tue, Jul 11, 2000 at 10:22:43AM +0000, Peter B. Mandeville wrote:
I have to concur with Brian.  I have an HP 810C here on my desk beside
me, which I drive using apsfilter and teTeX 1.07 under FreeBSD, and I
have never seen a TeX/Postscript problem.

If you convert the entire document to PostScript, can you preview it
on screen?  If there are problems, you should see some diagnostics for it.

	Ross
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help 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-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
On Tue, Jul 11, 2000 at 05:29:36PM +0100, Prof Brian D Ripley wrote:
I also had problems integrating R-generated files named *.ps, but when I 
dumped them as *.eps files (on reading help), they worked much 
better in LaTeX.

My setup is on Win98, running MikTeX/LaTeX (an older version, but quite 
stable), and using Ghostscript6.01/GSView 2.9 to drive a Lexmark 2050 color
jetprinter using the mswinpr2 printer option in GSView.

james marca
Institute of Transportation Studies
UC Irvine

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help 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-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
"Peter B. Mandeville" wrote:

            
I use almost the same setup (excepting R is compiled from source and the printer
is an HP Deskjet 690C) and it works brilliantly (better, in fact, than my Deskjet
1600CM which has a Postscript interpreter).  Unless I am mistaken, you didn't
mention whether you could print the R Postscript output directly, e.g.

postscript(...)
plot(...)
dev.off()
system("lpr"...)

 If so, it's not R causing the trouble.  The GIMP, like most other image
manipulation programs, simply interprets the Postscript and outputs a raster
image. which tends to be less likely to be screwed up by downstream programs.

Jim

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help 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-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._