[R] Printing to PDF in for

Romain Francois romain.francois at dbmail.com
Mon Dec 14 12:13:18 CET 2009


See the "onefile" and "file" arguments of ?pdf and then do something 
like this :

pdf( file = "plot-%03d.pdf", onefile = FALSE, width = 9.25, height = 
9.25, family="Helvetica",pointsize=8,bg="white" )

Romain

On 12/14/2009 12:09 PM, Trafim Vanishek wrote:
>
> Hi everybody,
>
> I would like to ask if it is possible using pdf function or some other to
> print plots in cycle such that every new plot is on new page.
>
> like this
>
> pdf(file="D:/Plot.pdf",width = 9.25,height=9.25,
> family="Helvetica",pointsize=8,bg="white")
>
> for (i in 1:10){
>
> x<- seq(1,40,1)
> y<- 2*x+1+5*rnorm(length(x))
>
> hist(y,freq = FALSE)
> plot(density(y))
> }
>
> dev.off( )
>
> but the problem is that I have a lot of other code in the cycle which I
> don't want to be printed in PDF.
>
> Thanks a lot for the help


-- 
Romain Francois
Professional R Enthusiast
+33(0) 6 28 91 30 30
http://romainfrancois.blog.free.fr
|- http://tr.im/HlX9 : new package : bibtex
|- http://tr.im/Gq7i : ohloh
`- http://tr.im/FtUu : new package : highlight




More information about the R-help mailing list