[R-SIG-Mac] Weird problem redirecting lattice graph to a file

Jorge A. Ahumada j.ahumada at conservation.org
Sun Aug 13 21:54:41 CEST 2006


I am having this weird issue where I cannot send a lattice graph to a device
like pdf() or png(), but this only happens when the statement is inside a
function. For example, this works:

> a <- matrix(0,5,5)
> pdf("test.pdf")
> levelplot(a)
> dev.off()

But now, put the last three statements in a function (F(a)) and the pdf is
not produced. I tried replacing pdf with
trellis.device(device="pdf",file="test.pdf") and it still does not work.

Funny thing is that plot() or image() will work inside a function as
expected when re-directing to other devices, but not any of the lattice

Any ideas?


Jorge A. Ahumada, Ph.D.
Technical Director, TEAM
Center for Applied Biodiversity Science
Conservation International
1919 M Street, NW Suite 600
Washington, DC 20036-3521
Ph: 202-912-1516

j.ahumada at conservation.org

More information about the R-SIG-Mac mailing list