[R] How to suppress plotting for "xyplot(zoo(x))"?

Gabor Grothendieck ggrothendieck at gmail.com
Tue Dec 21 14:40:02 CET 2010

On Tue, Dec 21, 2010 at 7:53 AM, Marius Hofert <m_hofert at web.de> wrote:
> Hi,
> I found the thread http://r.789695.n4.nabble.com/Matrix-as-input-to-xyplot-lattice-proper-extended-formula-syntax-td896948.html
> I used Gabor's approach and then tried to assign the plot to a variable (see below). But a Quartz device is opened... why? I don't want to have anything plot/printed, I just would like to store the plot object. Is there something like "plot = FALSE"?
> Cheers,
> Marius
> library(lattice)
> library(zoo)
> df <- data.frame(y = matrix(rnorm(24), nrow = 6), x = 1:6)
> xyplot(zoo(df[1:4], df$x), type = "p")
> plot.object <- xyplot(zoo(df[1:4], df$x), type = "p") # problem: a Quartz device is opened (on Mac OS X 10.6)

This also opens up a window on Windows.   It occurs within lattice
when lattice issues a trellis.par.get .  A workaround would be to open
a device directed to null.  On Windows this would work.  I assume if
you use "/dev/null" it would work on your machine.

plot.object <- ...

Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com

More information about the R-help mailing list