Hi Jian, Take a look at http://CRAN.R-project.org/doc/FAQ/R-FAQ.html#Why-do-lattice_002ftrellis-graphics-not-work_003f
<http://CRAN.R-project.org/doc/FAQ/R-FAQ.html#Why-do-lattice_002ftrellis-graphics-not-work_003f> HTH, Jorge On Sun, Apr 4, 2010 at 2:52 AM, Jian Zhang <> wrote: > > Hey, folk. > > I am trying to get many figures by using the function "xyplot" in the > library "lattice". I tried to using the loop to finish it quickly. But I > cannot open the saved file after I run the program. But if I use the > function "plot" to get other simply figures, it can work. So I want to ask > how I can get the saved figures by using "xyplot". > > The following is a simple example about my program: > library(lattice) > require(stats) > ## Tonga Trench Earthquakes > Depth <- equal.count(quakes$depth, number=8, overlap=.1) > for (i in 1:5) { > filename=paste("fig",i,".pdf",sep="") > pdf(filename,width=6.5,height=4.5) > xyplot(lat ~ long | Depth, data = quakes) > graphics.off() > } > # I cannot open the pdf files. > > Buf if I try: > for (i in 1:5) { > filename=paste("fig",i,".pdf",sep="") > pdf(filename,width=6.5,height=4.5) > plot(lat ~ long, data = quakes) > graphics.off() > } > > # I can open the pdf files. > > Hope you can help me. > Thanks so much, > > --- > Jian Zhang > Department of Renewable Resources > University of Alberta > Edmonton, Alberta T6G 2H1, Canada > Phone (office): 780-492-8670 > Email: jzhang1...@gmail.com; zj...@ualberta.ca > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.