Hi all, 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. Thanks for your attention. Much appreciated. Chris -- View this message in context: http://www.nabble.com/Exporting-Numerous-Graphs-tp25430649p25430649.html Sent from the R help mailing list archive at Nabble.com.
Polwart Calum (County Durham and Darlington NHS Foundation Trust)
2009-Sep-14 08:29 UTC
[R] Exporting Numerous Graphs
> 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}}
You can wite them out as single files (png('file-%02d.png',...)) and then import them to Word. On Mon, Sep 14, 2009 at 1:55 AM, Chris Li <chrisli at austwaterenv.com.au> wrote:> > Hi all, > > 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. > > Thanks for your attention. Much appreciated. > > Chris > -- > View this message in context: http://www.nabble.com/Exporting-Numerous-Graphs-tp25430649p25430649.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >-- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve?
Try this: library(RDCOMClient) w <- COMCreate('Word.Application') w[["Visible"]] <- TRUE w[["DisplayAlerts"]] <- FALSE doc <- w$Documents()$Add(Template="Normal", NewTemplate=FALSE, DocumentType=0) fooPasteGraphs <- function(index, ...){ win.metafile() plot(rnorm(100)) dev.off() w$Selection()$Paste() } lapply(1:27, fooPasteGraphs) doc$SaveAs(FileName = "graphs.doc", FileFormat = "wdFormatDocument") doc$Close() w$Quit() doc <- w <- NULL rm(doc, w) On Mon, Sep 14, 2009 at 2:55 AM, Chris Li <chrisli@austwaterenv.com.au>wrote:> > Hi all, > > 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. > > Thanks for your attention. Much appreciated. > > Chris > -- > View this message in context: > http://www.nabble.com/Exporting-Numerous-Graphs-tp25430649p25430649.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >-- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O [[alternative HTML version deleted]]