[R] Exporting Numerous Graphs

Polwart Calum (County Durham and Darlington NHS Foundation Trust) calum.polwart at nhs.net
Mon Sep 14 10:29:01 CEST 2009


> 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 yo...{{dropped:21}}




More information about the R-help mailing list