# [R] Lattice: how to change the canvas size with Sweave

Gerrit Draisma gdraisma at xs4all.nl
Sun Nov 17 12:43:06 CET 2013

Dear all,
I would like to include a wide graph with narrow height in my LaTeX
output. Up to now I only get it done using Stangle and including
pdf("pietje-001.pdf",width=7,height=4)
xyplot(...)
dev.off()
What is the correct way of setting the canvas size?
Thanks.
Gerrit Draisma

==========pietje.tex
\documentclass{article}
\title{How to define the size of the plotting canvas?}
\author{Gerrit Draisma}
\begin{document}
\maketitle
I would like to make this a wide graph with a small height.
How do I do that?
<<>>=
library(lattice)
@
\raggedbottom
\begin{figure}[!h]
\centering
<<echo=FALSE,fig=TRUE>>=
xyplot(runif(11)~(0:10),type="l", aspect=0.4,
scales=list(x=list(tick.number=11),y=list(tick.number=3)))
@
\caption{The canvas is too big!}
\end{figure}
\end{document}
==========