[R] Lattice: Saving multiple plots

Deepayan Sarkar deepayan at stat.wisc.edu
Mon Mar 31 06:46:09 CEST 2003


On Sunday 30 March 2003 03:30 pm, Peter Ho wrote:
> Hi  lattice users,
>
> Is there a way to automatically save trellis plots , when "layout" is
> used to produce graphs on more than one page (graph window). In the
> example below, I have 4 graphs on each  of 4 pages. I want to save each
>  page separately.
>
> ######
> splom(~final.princomp.pc.scores.five[1:3]|Syrup.time*Massequite.temp,
> groups=Batch.number,data= final.princomp.pc.scores.five,
> panel = panel.superpose,
> key = list(title = "Batches",
>                   points = list(pch = super.sym$pch[1:14],
>                  col = super.sym$col[1:14]),
>                  text =
> list(c("1","2","3","4","5","6","7","8","9","10","11","12","13","14")),
>             columns=7),aspect=1,layout = c(2,2,4))
> #####
>
> With only one page of graphs I would normally use the following script
> in the beginning.For example:
>
> #####
> jpeg(file="graph1.jpeg", width=960, height=960, quality=100)
> #####
>
> Is there a similar way to save these graphs?

Following documentation in ?jpeg, 

jpeg(file="graph%03d.jpeg", width=960, height=960, quality=100)

would seem to work (creating files graph001.jpeg, graph002.jpeg, etc).

-Deepayan



More information about the R-help mailing list