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

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

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

mhofert
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)
______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: How to suppress plotting for "xyplot(zoo(x))"?

Gabor Grothendieck
On Tue, Dec 21, 2010 at 7:53 AM, Marius Hofert <[hidden email]> 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.

png("NUL")
plot.object <- ...
dev.off()





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

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: How to suppress plotting for "xyplot(zoo(x))"?

Gabor Grothendieck
On Tue, Dec 21, 2010 at 8:40 AM, Gabor Grothendieck
<[hidden email]> wrote:

> On Tue, Dec 21, 2010 at 7:53 AM, Marius Hofert <[hidden email]> 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.
>
> png("NUL")
> plot.object <- ...
> dev.off()

Also Yihui Xie found an undocumented NULL device which you could try  See:
  http://yihui.name/en/2010/12/a-special-graphics-device-in-r-the-null-device/

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

______________________________________________
[hidden email] 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.