[R] Lattice .ps graphic is rotated in LaTeX slides

Patrick Drechsler patrick.drechsler at gmx.net
Fri Oct 1 18:52:26 CEST 2004


Hi Michael,

Michael Friendly wrote on 01 Oct 2004 16:09:45 MET:

> I've generated a version of the classic dotplot of the barley
> data with

[sniped R-code]

> It looks fine with gv

The image is in landscape format when viewed with gv.

> \begin{slide}
> \includegraphics[,height=.6\textheight]{fig/barley2x3.ps}
                  ^^^typo or copy&paste error?
> \end{slide}
>
> the image is rotated 90 deg CCW.  I tried to adjust for this
> with
>
> \includegraphics[angle=-90,height=.6\textheight]{fig/barley2x3.ps}

Short answer: use `width' instead of `height':

  \includegraphics[angle=-90,width=.8\linewidth]{fig/barley2x3}

Long answer:

,----[ http://www.tex.ac.uk/cgi-bin/texfaq2html?label=divzero ]
| Graphics division by zero
| 
| While the error
| 
| ! Package graphics Error: Division by 0.
| 
| can actually be caused by offering the package a figure which
| claims to have a zero dimension, it's more commonly caused by
| rotation.
| 
| Objects in TeX may have both height (the height above the
| baseline) and depth (the distance the object goes below the
| baseline). If you rotate an object by 180 degrees, you convert
| its height into depth, and vice versa; if the object started
| with zero depth, you've converted it to a zero-height object.
| 
| Suppose you're including your graphic with a command like:
| 
| \includegraphics[angle=180,height=5cm]{myfig.eps}
| 
| In the case that myfig.eps has no depth to start with, the
| scaling calculations will produce the division-by-zero error.
| 
| Fortunately, the graphicx package has a keyword totalheight,
| which allows you to specify the size of the image relative to
| the sum of the object's height and depth, so
| 
| \includegraphics[angle=180,totalheight=5cm]{myfig.eps}
| 
| will resolve the error, and will behave as you might hope.
| 
| If you're using the simpler graphics package, use the * form of
| the \resizebox command to specify the use of totalheight:
| 
| \resizebox*{!}{5cm}{%
|   \rotatebox{180}{%
|     \includegraphics{myfig.eps}%
|   }%
| }
| 
`----

HTH

Patrick
-- 
Computer games don't affect kids. If Pacman would have affected us as
children, we would now run around in darkened rooms, munching pills
and listening to repetetive music.




More information about the R-help mailing list