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

______________________________________________
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.

Reply via email to