Skip to content

R bug or ghostscript bug or my bug?

2 messages · ivo welch, Brian Ripley

#
Dear R developers:

The following R program produces a pdf file that does not survive
ghostscript distillation correctly.  The undistilled version is at
http://welch.econ.brown.edu/temp/try.PDF while the distilled version
is at http://welch.econ.brown.edu/temp/try.pdf .  When previewed, the
points are wrong in the distilled .pdf version, but only in one of the
two points invokations (huh?) .  The program that generated the pdf
files is

x= 1:10; y1= x; y2= y1/2;

plot.one = function( x, y ) {
  lines( x, y, col="blue");
  points( x, y, col="blue", pch=21, cex=1);
}

pdf(file = "try.PDF")

plot(0, type="n", xlim=c(1,10), ylim=c(1,10))

plot.one( x, y1 )
plot.one( x, y2)

dev.off()

system("ps2pdf14  try.PDF try.pdf")  # distillation.

-----------------------------

Obviously, the error can be in ghostscript, not in R.  Or it can be
that R produces a pdf file that has some slight problems that do not
usually show up, except when distilled.


Before I get too badly flamed, feel free to ignore this.  I am just
trying to help.  It took me some time to whittle down the program to
isolate the problem.


R was invoked under OSX via "R --vanilla" and is version 2.8.1.

ghostscript is 8.62 (2008-02-29) under OSX.

(It should be easy to check whether this also occurs under linux.)

/iaw
#
I think you are misusing 'distill' here.  The canonical distiller is 
Adobe Acrobat's. and that converts ps to pdf.

I've tried your example, and Acrobat can optimize it (probably what 
you wanted) and if I convert it to .eps in Acrobat, Distiller can 
distill it.

So, nothing wrong with R's pdf files (yet again).

(For completeness, I used Acrobat 9 Pro.)
On Mon, 19 Jan 2009, ivo welch wrote: