[R] a fix for rotated PDF graphs

Prof Brian Ripley ripley at stats.ox.ac.uk
Sat Apr 3 12:19:07 CEST 2004


The problem is simply that you are using epstopdf incorrectly.  This is 
not an R issue but the correct solution has been discussed here before
(although my quick searches failed to locate it in the archives).

First, if you want `PDF graphs' you can make them in R with the pdf() 
device.  I am very surprised you did not mention that.

Second, if you insist on using distiller or gs (via epstopdf) you need to
unset the option that rotates plots automatically.  It's documented in 
ps2pdf.htm:

  By default Ghostscript determines viewing page orientation based on the 
  dominant text orientation on the page. Sometimes, when the page has text 
  in several orientations or has no text at all, wrong orientation can be 
  selected.

  Acrobat Distiller parameter AutoRotatePages controls the automatic 
  orientation selection algorithm. On Ghostscript, besides input stream, 
  Distiller parameters can be given as command line arguments. For 
  instance: -dAutoRotatePages=/None or /All or /PageByPage.

You want /None.


On Sat, 3 Apr 2004, Tamas Papp wrote:

> I have found references for the following problem in the list
> archives, but no nice solution.  So I decided to post one I came up
> with.
> 
> The problem is that graphs output as eps files, for example using
> 
> ps.options(onefile=FALSE, paper="special", width=8, height=8,
>            horizontal=FALSE, pointsize=12)
> 
> get rotated when I convert them to pdf using epstopdf.  Both ghostview
> and acroread display them rotated, so I don't think it's an actual
> acroread bug.  I am using R 1.8.1.

No, it's user error.  You asked gs to rotate them.

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list