[R] xyplot question

Saiwing Yeung saiwing at berkeley.edu
Wed Jan 19 22:54:05 CET 2011


Hi all,

I had a weird problem with xyplot and I am wondering if anyone can help me figure out what's wrong here. Basically if I call xyplot() inside a function and I call quartz() after, then the previous xyplot() does not do anything. A short demo of the issue is like this:


library(lattice)
plot.trends <- function()
{
	mat <- data.frame(cbind(rnorm(100), rnorm(100)))
	names(mat) <- c("x", "y")
	quartz()
	xyplot(y ~ x, data=mat)
	quartz() # plotting works if this line is removed
}
plot.trends()


* if I run this as is, the xyplot() doesn't do anything, I only see 2 empty quartz window
* replacing quartz() with X11() doesn't help.
* if the content of the function is copied and run directly then it works fine.
* if the second quartz() statement is removed then it also works.


Here is my system info.
* R 2.12.0
* R.app GUI 1.35 (5632) i386-apple-darwin9.8.0
* lattice_0.19-17


any suggestions? Thanks in advance!

Saiwing Yeung



More information about the R-help mailing list