Skip to content

defmacro and bwplot incompatibilities?

3 messages · Jeff Newmiller, Geoffrey

#
My macro doesn't work for bwplot. But is working elsewhere.
What changes should i make to fix my macro.
Thanks.

The complete code sample is:
library(gtools)
library(lattice)

pic <- defmacro(fn, plotfunc, expr={png(filename=fn); plotfunc; dev.off()})

# this one fails.
pic("bw.png", {bwplot(Species ~ Sepal.Length, data=iris)})

# this one works
pic("p.png", {plot(iris$Sepal.Length)}
#
bwplot is a trellis function. There is something very basic about the way that library works that any intro to trellis/lattice should tell you:

http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-do-lattice_002ftrellis-graphics-not-work_003f
---------------------------------------------------------------------------
Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<jdnewmil at dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
                                      Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
--------------------------------------------------------------------------- 
Sent from my phone. Please excuse my brevity.
Geoffrey <lordgeoffrey at optusnet.com.au> wrote:

            
#
Perfect, thanks very much.
On 10/12/12 02:00, Jeff Newmiller wrote: