This is FAQ 7.22. Lattice functions produce graphic objects, which are not displayed by default. If you print your graph, you should be fine. Also, take a look at the documentation for panel.xyplot. Using type = c("p", "r") should make things simpler. Regards, Matt Wiener -----Original Message----- From: r-help-bounces at stat.math.ethz.ch [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of jessica.gervais at tudor.lu Sent: Tuesday, October 03, 2006 8:00 AM To: R-help at stat.math.ethz.ch Subject: [R] postcript file / xyplot function [Broadcast] Hi, I would like save a curve in a postscript file. It when I use a common "plot" function (plot) postscript(file="file.eps") plot(x,y) dev.off() It's not working with the "xyplot" function (lattice package). postscript(file="Z",height=8,width=8,horizontal=FALSE) xyplot(data[,3]~data[,2]|data[,1],panel=function(x,y){panel.xyplot(x,y) COEFF<-coef(lm(log(y)~x)) panel.curve(exp(COEFF[1]+COEFF[2]*x)) dev.off() Do anyone know how to use the postscript function with a xyplot function ? Thanks by advance Jessica Gervais [[alternative HTML version deleted]] ______________________________________________ R-help at stat.math.ethz.ch 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. ------------------------------------------------------------------------------ Notice: This e-mail message, together with any attachments,...{{dropped}}
Richard M. Heiberger
2006-Oct-03 13:16 UTC
[R] postcript file / xyplot function [Broadcast]
I recommend you get a better editor, one that highlights mismatched parentheses. Your statement xyplot(data[,3] ~ data[,2] | data[,1], panel=function(x,y) {panel.xyplot(x,y) was never completed, the close "}" is missing, hence it never executed. Please use better spacing in your functions as it makes it easier for the human to read them. In this example, since you are using the default panel function, the simpler statement xyplot(data[,3] ~ data[,2] | data[,1]) would have sufficed. Even better, use a data.frame, rather than a matrix, and use variable names for legibility, and you could write xyplot(y ~ x | a, data=mydata) Rich