Hi,

It's probably easiest with the pdf (or postscript) device,

pdf("all.pdf")
for(ii in 1:27)
  plot(rnorm(10), main=paste("plot", ii))
dev.off()

Bitmap-based devices can generate sequential filenames (Rplot1.png,
Rplot2.png, ...) that you could combine in a single document using external
tools (e.g. a pdf file with latex, or an html template that you can view in
a browser, etc.).

For example, create the following file "template.brew",

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
    "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
  <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8">
    <title>title</title>
    <link rel="stylesheet" type="text/css" href="style.css">
    <script type="text/javascript" src="script.js"></script>
  </head>
  <body>

<%
for (ii in 1:27) {
 filename <- paste("plot",ii, ".png", sep="")
 png(filename)
 plot(rnorm(10), main=paste("plot", ii))
dev.off()
%>

<p><img src="<% cat(filename) %>"> <p/>

<% } %>

 </body>
</html>


and process it in R using,

library(brew)
brew("template.brew", "template.html")



HTH,

baptiste





2009/9/14 Polwart Calum (County Durham and Darlington NHS Foundation Trust)
<calum.polwart@nhs.net>

> > I have got 27 graphs to export (not a lot...I know!). How can I fit all
> of
> > them into a single file like PNG without adjusting the size of the
> graphs?
> > What's in my mind is like pasting graphs into Word, in which I can just
> > scroll down to view the graphs.
>
> Pretty sure PNG can only cope with single 'page' images - the page can be
> as big as it wants but then when it comes to things like printing its gonna
> cause problems as I doubt many graphics packages can split it over the page?
>  So they'll either crop it or scale it.  27 on 1 page is gonna be very
> small?
>
> TIFF can handle multiple pages and of course so can PDF.  I don't know of
> an export to TIFF function.  So I'd suggest exporting to PDF - and exporting
> to 27 different file names (1 to 27.pdf)  Then using a tool like pdfshuffler
> (linux GUI based) or using command line ghostscript (windows or linux)
>
> gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=merged.pdf 1.pdf
> 2.pdf 3.pdf ...etc... 27.pdf
> (This is a linux command not a R command.  The widnwos version will be very
> simillar I suspect)
>
> That'd give you a 27 page pdf file with each graph on a new page?  Much
> easier to scroll through than using a scroll bar on a graphics package - you
> can go back to Page 5 and on to page 9 to compare quickly rather than having
> to manually scroll to find the right info.  Plus PDF is vector based which
> means future importing into decent desktop publishing packages should avoid
> and issues with loss / scaling.
>
> I believe its also possible with psmerge using postscript and so possible
> EPS files.
>
>
>
> ********************************************************************************************************************
>
> This message may contain confidential information. If ...{{dropped:29}}


