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
Can someone suggest which method shud I use for such.
Thanks
Mohan
Code:
for(i in 1:19) {
query <- d$V1[i];
print(query)
#pdf(paste(i,".pdf", sep=""));
x11();
plot(c2data[start1:count,],c3data[start1:count,],xlab="Buildings",
ylab="Sky", sub=i);
points(c2data[query,],c3data[query,], pch=20, col=''blue'');
grid();
dev.print()
dev.copy2eps();
dev.copy()
start1 <- count + 2;
#print(start1)
val <- val-1;
#print(val)
count <- count + val;
#print(count)
}
[[alternative HTML version deleted]]
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 emptyDid 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