Gerrit Draisma
2013-Nov-17 11:43 UTC
[R] Lattice: how to change the canvas size with Sweave
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} ==========
Gerrit Draisma
2013-Nov-17 12:16 UTC
[R] Lattice: how to change the canvas size with Sweave
Oops, I forget to write the I included the lines pdf()..(dev.off() in the file pietje.R generated by Stangle. And now I see that included pietje.tex in reality was named pietje.rnw with pietje.tex the result from Sweave. Apologies for this confusion Gerrit. op 11/17/2013 12:43 PM Gerrit Draisma schreef:> 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} > ==========