[R] One question about saving graph by using xyplot

Duncan Mackay mackay at northnet.com.au
Sun Apr 4 10:02:00 CEST 2010


Hi
Not that long ago  there was this
See
http://tolstoy.newcastle.edu.au/R/e10/help/10/04/0003.html

Duncan

Duncan Mackay
Department of Agronomy and Soil Science
University of New England
ARMIDALE NSW 2351
Email home: mackay at northnet.com.au


At 16:52 4/04/2010, you 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: jzhang1982 at gmail.com; zjian at ualberta.ca
>
>
>         [[alternative HTML version deleted]]
>
>______________________________________________
>R-help at 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.



More information about the R-help mailing list