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

2004-10-02 Thread John Maindonald
On 2 Oct 2004, at 8:04 PM, [EMAIL PROTECTED] wrote:
On Fri, 2004-10-01 at 10:58, Peter Dalgaard wrote:
Michael Friendly [EMAIL PROTECTED] writes:
! Package graphics Error: Division by 0.
What am I doing wrong, or how could I do it differently so it would 
work?
You might try \usepackage{graphicx} instead. I seem to recall
(vaguely) getting better results with that sometimes.

That should be part of the preamble for using 'seminar', if it is setup
properly.
There is a decent tutorial for using seminar at:
http://astronomy.sussex.ac.uk/~eddie/soft/tutorial.html
There is also a great reference for including graphics in LaTeX:
www.ctan.org/tex-archive/info/epslatex.pdf
FWIW, though I have been using seminar for such presentations, I have
been recently looking at the Beamer package:
http://latex-beamer.sourceforge.net/
and of course, there is also the Prosper package:
http://prosper.sourceforge.net/
The one advantage of the Beamer package, for those that require it, is
that it supports pdflatex, which the others do not. Though, it can be
used with dvips/latex + ps2pdf, where needed.
HTH,
Marc
Note also the package pdfscreen, for use with pdflatex
www.river-valley.com/download2.shtml
This pretty much uses regular latex, with the page dimensions
changed and the font attributes redefined to make them
larger than usual inside the slide environment.  Be sure to
load the packages xspace and colortbl as well as pdfscreen.
John Maindonald email: [EMAIL PROTECTED]
phone : +61 2 (6125)3473fax  : +61 2(6125)5549
Centre for Bioinformation Science, Room 1194,
John Dedman Mathematical Sciences Building (Building 27)
Australian National University, Canberra ACT 0200.
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


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

2004-10-01 Thread Michael Friendly
I've generated a version of the classic dotplot of the barley data with
library(lattice)
data(barley)
trellis.device(postscript, color=TRUE, file=barley2x3.ps)
old.settings - trellis.par.get()
trellis.par.set(background, list(col = white))
lset(list(superpose.symbol=list(pch=c(19, 1, 25, 2, 15, 22, 23),
  cex=rep(1,7),col=c(blue, red, darkgreen, brown,
  orange, turquoise, orchid) )))
lset(list(fontsize = list(default = 14)))
n - length(levels(barley$year))
dotplot(variety ~ yield | site, data = barley, groups = year,
layout = c(2, 3), aspect = .5,
xlab = Barley Yield (bushels/acre),
key = list(points = Rows(trellis.par.get(superpose.symbol), 1:n),
  text = list(levels(barley$year)), columns = n))
dev.off()
lset(theme=old.settings)
It looks fine with gv (though I'd like to make the bounding box 
tighter), but when I embed it in a LaTeX slide
(landscape, using seminar package),

\begin{slide}
\includegraphics[,height=.6\textheight]{fig/barley2x3.ps}
\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}
but  that gives
! Package graphics Error: Division by 0.
What am I doing wrong, or how could I do it differently so it would work?
thanks
--
Michael Friendly Email: [EMAIL PROTECTED] 
Professor, Psychology Dept.
York University  Voice: 416 736-5115 x66249 Fax: 416 736-5814
4700 Keele Streethttp://www.math.yorku.ca/SCS/friendly.html
Toronto, ONT  M3J 1P3 CANADA

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


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

2004-10-01 Thread Peter Dalgaard
Michael Friendly [EMAIL PROTECTED] writes:

 ! Package graphics Error: Division by 0.
 
 What am I doing wrong, or how could I do it differently so it would work?

You might try \usepackage{graphicx} instead. I seem to recall
(vaguely) getting better results with that sometimes.

-p

-- 
   O__   Peter Dalgaard Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics 2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark  Ph: (+45) 35327918
~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


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

2004-10-01 Thread Marc Schwartz
On Fri, 2004-10-01 at 10:58, Peter Dalgaard wrote:
 Michael Friendly [EMAIL PROTECTED] writes:
 
  ! Package graphics Error: Division by 0.
  
  What am I doing wrong, or how could I do it differently so it would work?
 
 You might try \usepackage{graphicx} instead. I seem to recall
 (vaguely) getting better results with that sometimes.


That should be part of the preamble for using 'seminar', if it is setup
properly.

There is a decent tutorial for using seminar at:

http://astronomy.sussex.ac.uk/~eddie/soft/tutorial.html

There is also a great reference for including graphics in LaTeX:

www.ctan.org/tex-archive/info/epslatex.pdf

FWIW, though I have been using seminar for such presentations, I have
been recently looking at the Beamer package:

http://latex-beamer.sourceforge.net/

and of course, there is also the Prosper package:

http://prosper.sourceforge.net/

The one advantage of the Beamer package, for those that require it, is
that it supports pdflatex, which the others do not. Though, it can be
used with dvips/latex + ps2pdf, where needed.

HTH,

Marc

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


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

2004-10-01 Thread Patrick Drechsler
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 copypaste 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.

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Lattice .ps graphic is rotated in LaTeX slides - PDF weirdness

2004-10-01 Thread Peter Dalgaard
Barry Rowlingson [EMAIL PROTECTED] writes:

 Marc Schwartz wrote:
 
  The one advantage of the Beamer package, for those that require it, is
  that it supports pdflatex, which the others do not. Though, it can be
  used with dvips/latex + ps2pdf, where needed.
 
 
   Has anyone else hit the problem that sometimes occurs with embedded
 PostScript graphics generated by R when viewed in full-screen mode
 using Adobe Acrobat Reader in Linux? Yes, its _that_ specific.

   You get black areas all round your graphic. It looks a mess. Does it
 in acroread4 and 5. But only Linux, and only full-screen mode.

Doesn't seem to want to happen to me, with acrobat 5, in full-screen
mode, on Linux, so it must be more specific than that...

-- 
   O__   Peter Dalgaard Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics 2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark  Ph: (+45) 35327918
~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Lattice .ps graphic is rotated in LaTeX slides - PDF weirdness

2004-10-01 Thread Marc Schwartz
On Fri, 2004-10-01 at 12:54, Peter Dalgaard wrote:
 Barry Rowlingson [EMAIL PROTECTED] writes:
 
  Marc Schwartz wrote:
  
   The one advantage of the Beamer package, for those that require it, is
   that it supports pdflatex, which the others do not. Though, it can be
   used with dvips/latex + ps2pdf, where needed.
  
  
Has anyone else hit the problem that sometimes occurs with embedded
  PostScript graphics generated by R when viewed in full-screen mode
  using Adobe Acrobat Reader in Linux? Yes, its _that_ specific.
 
You get black areas all round your graphic. It looks a mess. Does it
  in acroread4 and 5. But only Linux, and only full-screen mode.
 
 Doesn't seem to want to happen to me, with acrobat 5, in full-screen
 mode, on Linux, so it must be more specific than that...


Can't say that I have ever seen that and I do use acroread 5 under FC2
for full screen slide presentations. 

Barry, do you have a specific R example that I could try to replicate
here?

Marc

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Lattice .ps graphic is rotated in LaTeX slides - PDF weirdness

2004-10-01 Thread Achim Zeileis
On 01 Oct 2004 19:54:45 +0200 Peter Dalgaard wrote:

 Barry Rowlingson [EMAIL PROTECTED] writes:
 
  Marc Schwartz wrote:
  
   The one advantage of the Beamer package, for those that require
   it, is that it supports pdflatex, which the others do not. Though,
   it can be used with dvips/latex + ps2pdf, where needed.
  
  
Has anyone else hit the problem that sometimes occurs with
embedded
  PostScript graphics generated by R when viewed in full-screen mode
  using Adobe Acrobat Reader in Linux? Yes, its _that_ specific.
 
You get black areas all round your graphic. It looks a mess. Does
it
  in acroread4 and 5. But only Linux, and only full-screen mode.
 
 Doesn't seem to want to happen to me, with acrobat 5, in full-screen
 mode, on Linux, so it must be more specific than that...

We had that problem with severl pdf-documents at useR! 2004. My
suspicion was that it depends somehow on the way the eps-graphic takes
until it ends up in the pdf-document. I seem to recall that those slides
were usually generated via 
  latex - dvips - ps2pdf
or maybe also via
  latex - dvipdf
although this tends to produce nicer pdf. But I never digged deeper into
this and just forced the presenters to use xpdf ;-)

BTW: when producing pdf-slides, especially with graphics produced by R,
I usually don't generate any eps at all but go directly from my Rnw-file
  Sweave - pdflatex
which produces very nice pdf output.
Z

 -- 
O__   Peter Dalgaard Blegdamsvej 3  
   c/ /'_ --- Dept. of Biostatistics 2200 Cph. N   
  (*) \(*) -- University of Copenhagen   Denmark  Ph: (+45)
  35327918
 ~~ - ([EMAIL PROTECTED]) FAX: (+45)
 35327907
 
 __
 [EMAIL PROTECTED] mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide!
 http://www.R-project.org/posting-guide.html


__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


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

2004-10-01 Thread Michael Friendly
That does indeed work!  I had read the arguments section of ?postscript, 
but this will teach me to read
the details.  There could/should be a trellis.device(eps, ...) that 
supplies the appropriate defaults.

For the perversely inclined I was able to use my original .ps file in 
this contorted way:

\rotatebox{180}{\includegraphics[angle=90,height=.6\textheight]{fig/barley2x3.ps}}
thanks,
-Michael
Marc Schwartz wrote:
On Fri, 2004-10-01 at 10:09, Michael Friendly wrote:
 

I've generated a version of the classic dotplot of the barley data with
library(lattice)
data(barley)
trellis.device(postscript, color=TRUE, file=barley2x3.ps)
old.settings - trellis.par.get()
   

 snip ...
Michael,
Try the following when specifying the trellis.device:
trellis.device(postscript, color = TRUE, file = barley2x3.eps,
   onefile = FALSE, paper = special, horizontal = FALSE,
   width = 9, height = 6)
See if that works without specifying the angle in your LaTeX for
seminar:
\begin{slide}
 \begin{center}
   \includegraphics[height=.6\textheight]{fig/barley2x3.eps}
 \end{center}
\end{slide}
Note that when including graphics in LaTeX, you should use EPS files,
which (as noted in ?postscript) require certain device settings to
create. These include:
onefile = FALSE, paper = special, horizontal = FALSE
and the device 'width' and 'height' settings.
This will also adjust the size of the bounding box.
HTH,
Marc Schwartz
 


--
Michael Friendly Email: [EMAIL PROTECTED] 
Professor, Psychology Dept.
York University  Voice: 416 736-5115 x66249 Fax: 416 736-5814
4700 Keele Streethttp://www.math.yorku.ca/SCS/friendly.html
Toronto, ONT  M3J 1P3 CANADA

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


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

2004-10-01 Thread Roger D. Peng
You might be encountering the infamous auto-rotation feature.  In Unix you can 
turn it off via something like

setenv GS_OPTIONS -dAutoRotatePages=/None
(or the bash equivalent).
-roger
Michael Friendly wrote:
I've generated a version of the classic dotplot of the barley data with
library(lattice)
data(barley)
trellis.device(postscript, color=TRUE, file=barley2x3.ps)
old.settings - trellis.par.get()
trellis.par.set(background, list(col = white))
lset(list(superpose.symbol=list(pch=c(19, 1, 25, 2, 15, 22, 23),
  cex=rep(1,7),col=c(blue, red, darkgreen, brown,
  orange, turquoise, orchid) )))
lset(list(fontsize = list(default = 14)))
n - length(levels(barley$year))
dotplot(variety ~ yield | site, data = barley, groups = year,
layout = c(2, 3), aspect = .5,
xlab = Barley Yield (bushels/acre),
key = list(points = Rows(trellis.par.get(superpose.symbol), 1:n),
  text = list(levels(barley$year)), columns = n))
dev.off()
lset(theme=old.settings)
It looks fine with gv (though I'd like to make the bounding box 
tighter), but when I embed it in a LaTeX slide
(landscape, using seminar package),

\begin{slide}
\includegraphics[,height=.6\textheight]{fig/barley2x3.ps}
\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}
but  that gives
! Package graphics Error: Division by 0.
What am I doing wrong, or how could I do it differently so it would work?
thanks
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html