R-beta: ps-graph in R and S confirmation

Helgi Tomasson (helgito@hag.hi.is)
Fri, 1 May 1998 09:41:02 +0000 (GMT)


From: helgito@hag.hi.is (Helgi Tomasson)
Message-Id: <199805010941.JAA27998@walras.hag.hi.is>
Subject: R-beta: ps-graph in R and S confirmation
To: r-help@stat.math.ethz.ch
Date: Fri, 1 May 1998 09:41:02 +0000 (GMT)


 
> > On Sat, 25 Apr 1998, Helgi Tomasson wrote: 
> > > I am creating postscript-graphics in R.  When I import them into
> > >  a LATEX document it is impossible to get the caption close 
> > >  to the figure.  I run the same program in Splus, and no problem
> > > of getting the caption just below the figure.  Another thing,
> > > the ps file that S created is only 10% of the size of the file
> > >  that R created.  What is wrong?  Are there some parameters to
> > >  be set?
Douglas Bates, sent the following script.

I can confirm.  This works, I get the caption close to the
ps-graph in my LATEX document.  This script shoulld  be somewhere
publicly available.  The size of the ps-file is for reason
explained in earlier messages 10 times larger in R than in S.

best regards to everyone who helped me with this

Helgi Tomasson

> 
> Sorry to get into this late - I have been off at a conference.  
> 
> The Aladdin distribution of ghostscript contains a script called
> ps2epsi that re-calculates and inserts a tighter bounding box.  It
> does this essentially by rendering the postscript code on a raster
> then determining a minimal bounding box for the raster.  
> 
> A disadvantage of using ps2epsi is that it also includes the raster
> image in the file so the figure can be rendered in a word processor,
> for example.  If you don't need that you can strip the file down a bit
> using a script that Bill Venables and I called ps2eps.
> 
> #!/bin/sh
> infile=$1
> if [ $# -eq 2 ]
> then
> 	outfile=$2
> else
> 	outfile=`basename ${infile} .ps`.eps
> fi
> ps2epsi $infile /tmp/X$$.epsi
> sed -e '/^%%BeginPreview/,/^%%EndPreview/d' -e '/^%%EOF/d' < /tmp/X$$.epsi > $outfile
> rm -f /tmp/X$$.epsi
> exit 0
> 


-- 
Helgi Tomasson                                       FAX:  354-552-6806
University of Iceland                                PHONE:354-525-4571
Faculty of Economics and Business Administration     email:helgito@hag.hi.is 
Oddi v/ Sturlugotu        
IS-101 Reykjavik
ICELAND

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._