[R] creating a ps. file

Timur Elzhov Timur.Elzhov at jinr.ru
Mon Mar 15 16:18:56 CET 2004


On Mon, Mar 15, 2004 at 12:37:02PM +0100, mike.campana at freesurf.ch wrote:

> I wrote a routine. At the end of each cycle of the loop I would like to 
> save the result (plot) in a postcriptfile.
> Of course if I just use dev.print in the following way: 
> dev.print(device=postcript, 'c:/Rfigures/plot_1.ps")
> I overwrite my results with the second cycle of the loop. I suppose 
> there is a way to define the file name so that several plots are 
> created(plot_1,plot_2...).
> 
> Could you give me an advice? Thanks a lot

for (i in 1:10) {
    x11(); plot(...)
    ...
    dev.copy2eps(file = paste("plot_", i, ".eps", sep = ""))
}

--
WBR,
Timur




More information about the R-help mailing list