[R] eps/pdf write help

Philipp Pagel p.pagel at wzw.tum.de
Thu Mar 12 17:08:48 CET 2009


On Thu, Mar 12, 2009 at 03:06:30PM +0000, Mohan Singh wrote:
> I am trying to print graphs as pdf's or eps in a for loop, but I can't seem
> to get it right
> 
>  
> 
> Either it prints only a single eps graph (overwrites) or when I use
> #pdf(paste(i,".pdf", sep="")) .. it prints all pdf's but they are empty

Did you remember to close the pdf files? Something like the following
should work:

x <- seq(0, 10, 0.01)
for (i in 1:5) {
	pdf(paste('plot', i, '.pdf', sep=''))
	plot(x, x^i)
	dev.off()
}

cu
	Philipp


-- 
Dr. Philipp Pagel
Lehrstuhl für Genomorientierte Bioinformatik
Technische Universität München
Wissenschaftszentrum Weihenstephan
85350 Freising, Germany
http://mips.gsf.de/staff/pagel




More information about the R-help mailing list