[R] Multiple groupedData plots in a postscript file using a loop

Uwe Ligges ligges at statistik.uni-dortmund.de
Sat Jan 17 16:20:48 CET 2004


Karl Knoblick wrote:
> Hallo!
> 
> I want to plot multiple grouped data in a postscript
> file using a loop. As I use a loop no plot (or just
> one empty plot) is generated. Here an example:
> 
> library(nlme)
> data(Loblolly) # example data from nlme
> postscript("PSFile.ps")
> for (i in 1:1) # just as example
> {
> 	plot(Loblolly)
> }
> dev.off()

Note that this is a lattice plot:

  class(Loblolly)
[1] "nfnGroupedData" "nfGroupedData"  "groupedData"    "data.frame"

Thus, the method plot.nfnGroupedData() producing a lattice plot is 
called by the generic plot().

So, you don't want to start postscript(), but
  trellis.device("postscript", file = "PSFile.ps")
  plot(Loblolly)
  dev.off()

Uwe Ligges


> Result: Just an empty PSFile.ps.
> (Withoput the loop it works.
> 
> May anybody help?
> 
> Karl
> 
> 
> __________________________________________________________________
> 
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html




More information about the R-help mailing list