[R] Landscape problems with ps2pdf

Douglas Bates bates at stat.wisc.edu
Fri Dec 1 14:40:35 CET 2000

Prof Brian D Ripley <ripley at stats.ox.ac.uk> writes:

> On Thu, 30 Nov 2000, Matthew Nelson wrote:
> > R Users,
> > 
> > I have created a multipage PostScript file using the postscript() function
> > with horizontal = TRUE to produce my plots in landscape.  I intended to
> > convert that entire file to PDF using ps2pdf to have the plots available for
> > a presentation.  Unfortunately, the resulting PDF document is rotated -90
> > degrees.
> Um, I think the problem is that the PDF document is rotated (as it should
> be), but the reader is not being told to display it rotated to landscape.
> That's ps2pdf's failing, nor R's, as Adobe Distiller does this as you
> intended with R plot files.

I encountered a similar problem when producing landscape slides with
LaTeX and dvips, then converting to PDF with ps2pdf.  (There are
reasons for not using pdflatex to go directly to PDF in this case.)
Saikat DebRoy discovered a fix for this somewhere on the Ghostscript
web site - I believe through searching at google.org first.

The fix is to edit the dvips-produced PostScript file by hand and
replace a single line of @landscape by an explicit setpagedevice.
Perhaps adding a setpagedevice in the Prolog for the R plots will do
the same - I haven't tried this.  The Setup section in the PostScript
produced by dvips is modified to be (the numbers 792 and 612 are the
page sizes for US-letter paper in PostScript points or 1/72 inch)

%%Feature: *Resolution 83dpi
TeXDict begin
  % @landscape
  << /PageSize [792 612] /Orientation 0 >> setpagedevice
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

More information about the R-help mailing list