[R] Sweave: pass scale parameter to includegraphics?

Peter Dunn dunn at usq.edu.au
Tue Jul 29 08:23:08 CEST 2003

Hi all

I'm using Sweave and find it a treat.  But one

I use Sweave to create my pictures which are
automatically included into LaTeX.  For example, 
in the file  test.Snw,  I may have:

% LaTeX stuff
x1 <- seq(1,5, length=10)
x2 <- sin(x1)
% More LaTeX

This produces the LaTeX file test.tex with the
(example) chuck:

% LaTeX stuff
% More LaTeX stuff

But what if I want the chunk to be, for example,
rather than the standard, no frills \includegraphics 
command?  (Why?  Because I create a picture that I
want small!  Changing  width  and  height within the
<<>>= only changes the appearance of the picture--it
alters the x11 window the plot is produced in, not
the final size in my document.)

How can I inform Sweave to create this in the
LaTeX code (not universally, but in the occasional
picture)?  More generally, how can I inform Sweave
to pass these types of parameters to the 
\includegraphics command?

I have searched archives and all the (obvious to me) 
places, but haven't found the solution.

Thanks again,


Dr Peter Dunn          (USQ CRICOS No. 00244B)
  Web:    http://www.sci.usq.edu.au/staff/dunn
  Email:  dunn @ usq.edu.au
Opinions expressed are mine, not those of USQ.  Obviously...

More information about the R-help mailing list