[R] plot width in Sweave

Achim Zeileis zeileis at ci.tuwien.ac.at
Tue Oct 7 19:57:24 CEST 2003


On Tuesday 07 October 2003 19:19, Christoph Lehmann wrote:

> Hi
>
> I didn't find this in the manual: I need to change the width of a
> plot while I use sweave, so which command/parameters should I insert
> below, to change the width of a plot
>
> \begin{figure}[htbp]
>   \begin{center}
> <<echo=TRUE, fig=TRUE>>=
> plot(Re(q),ylab ="",type="o",col="blue",lwd=1, sub=mystring)
> @
>     \caption{Original stick function (stimulus train)}
>   \end{center}
> \end{figure}


Depends what exactly you want to change. If you to change the width of 
the eps/pdf file you could say

  <<echo=TRUE,fig=TRUE,height=4,width=6>>=

as you would do in a postscript() or pdf() call in R.


If you want to increase the width of the plot in LaTeX, you could do

  \setkeys{Gin}{width=0.8\textwidth}

which corresponds to the setting of

  \includegraphics[width=0.8\textwidth]{mygraphic}

hth,
Z


> many thanks
>
> christoph




More information about the R-help mailing list