Desktop Survival Guide
by Graham Williams

Figure Sizes

Figures will be typeset within the document, when the option fig=TRUE is set. The default is to typeset the figure to be 80% the width of the text width. This can be reset with something like \setkeys{Gin}{width=0.75\textwidth}.

By default the figures generated by Sweave (as .eps and .png files) are 7x7 inches. Changing, for example, the default output size with the pdf function does not affect the pdf produced by Sweave. The following example illustrates:

> pdf.options(width=5, height=3)
> pdf("reporting_pdf_size.pdf")
> plot(1:20)


Figure 39.3: Example changing the proportions.
Image reporting_pdf_size

However, within Sweave:

> pdf.options(width=5, height=3)
> plot(1:20)

Image dmsurvivor-reporting:pdf_size_options_not_work

Instead, the options are set using the width and height options within the Sweave header for that block:

> plot(1:20)

Image dmsurvivor-reporting:pdf_size_options_in_header

These dimensions can be set for the following portion of the document with \SweaveOpts{width=5, height=3}.

Copyright © 2004-2010 Togaware Pty Ltd
Support further development through the purchase of the PDF version of the book.
The PDF version is a formatted comprehensive draft book (with over 800 pages).
Brought to you by Togaware. This page generated: Sunday, 22 August 2010