If you do it the way I just wrote, you will get 1 pdf file with many figures
inside it.
If you want several files, you can use something like:
png(filename = "Rplot%03d.png")

Instead of using "pdf" in my last example.

Keep this outside the loop :)

p.s: at this point you probably have numerous open graphic devices.  Press
dev.off() until they are all closed...

Tal

----------------Contact
Details:-------------------------------------------------------
Contact me: Tal.Galili@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
----------------------------------------------------------------------------------------------




On Fri, Oct 22, 2010 at 9:50 PM, <news@aleblanc.cotse.net> wrote:

> Tal Galili <tal.galili@gmail.com> writes:
>
> > I suspect that using "dev.copy2eps" Is not going to help you here.
> >
> > Please try again using:
> >
> >  pdf(...)  # Check: ?pdf
> >  for(i in something)
> >  {
> >     plot(things)
> >  }
> >  dev.off()
> >
> > But give pdf() the file path.
> > Make sure you can make it work with simple plots.  then check it on your
> > situation, and let us know if it works :)
> > (I had it work with very heavy plots - so I trust it will work for you)
> >
> > (p.s: please keep cc'ing the r-help list so others will know the stage of
> your
> > problem, in case others would like to add more help :) )
> >
> > Cheers,
> > Tal
> >
>
> The problem is that the filename changes with each iteration of the loop,
> so I need to
> save the graph inside the loop.
> I tried this:
>
> for(...)
> {
>    ...
>    pdf(...)
>    barplot(...)
> }
>
> but I just got a load of empty graphs.
>
> --
> aleblanc
>

	[[alternative HTML version deleted]]

