[R-SIG-Mac] Bitmap and undesired rotated figure

Prof Brian Ripley ripley at stats.ox.ac.uk
Wed Feb 17 09:56:24 CET 2010


First, this is not what 'bitmap' is intended for.  R has a pdf() 
device, and on Macs quartz() can produce PDF: producing PostScript and 
converting it to PDF is cumbersome and you have given us no indication 
of why you did this (and it is not a good idea for other reasons: see 
the last para of my reply).

You have experienced a design decision that ps2pdf copied from Acrobat 
Distiller, which is auto-rotation of pages into PDF.  It has puzzled 
users many times over the years (including on R mailing lists), not 
least as the defaults in gs were changed not long after I wrote 
bitmap().

Auto-rotation is done by default page-by-page based on the orientation 
of all of the text on the page, and in your examples the axis 
labelling is the only text and is about half/half landscape and 
portrait. In examples 1 and 3, the axis labeliing differs and the 
decision is different.

AFAICS you have not told us your version of R (see the R posting guide 
which asked for it), and there is a typo in some. Look for a line 
like

                  " -dAutoRotatePages=/None",

in bitmap().  If it does not have a space after the first quote, edit 
bitmap to add it: this should then suppress auto-rotation.

Finally, a technical point.  Although type="pdfwrite" works, it does 
not set up gs optimally for that conversion and so works less well 
that simply producing PostScript and calling ps2pdf -- but you will 
need to suppress auto-rotation there too.


On Tue, 16 Feb 2010, Andrej wrote:

> Hi,
>
> I encounter the problem using bitmap function to plot pdf type figures
> in an array (calling mfrow function). Consider the following three
> examples:
>
> # Example 1
> bitmap("test1.pdf", type="pdfwrite", units="mm", height=50, width=100)
> par(mfrow=c(1,2))
> plot(1:5)
> plot(1:10)
> dev.off()
>
> # Example 2
> pdf("test2.pdf",height=5,width=10)
> par(mfrow=c(1,2))
> plot(1:5)
> plot(1:10)
> dev.off()
>
> # Example 3
> bitmap("test3.pdf", type="pdfwrite", units="mm", height=50, width=100)
> par(mfrow=c(1,2))
> plot(rnorm(100))
> plot(rnorm(100))
> dev.off()
>
> In Example1 the figure is roteted; this is not the case in the Example
> 3 where I call rnorm() function. Example 2 seems fine. The gs version
> installed is:
>
> gs -v
> GPL Ghostscript 8.70 (2009-07-31)
> Copyright (C) 2009 Artifex Software, Inc.  All rights reserved.
>
> Could somebody reproduce these examples and/or explain me why the
> plots in the second example are rotated.
>
> Thanks in advance.
>
> Best, Andrej
>
> _______________________________________________
> R-SIG-Mac mailing list
> R-SIG-Mac at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
>

-- 
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-SIG-Mac mailing list