[R] setHook and lattice

From: Jim Price <price_ja_at_hotmail.com>
Date: Fri, 29 Feb 2008 10:05:10 -0800 (PST)

Hi,

I am trying to find a way to automate production of page numbers in plots produced using the lattice package. To do this, I started playing around with setHook which works fine with vanilla plot, but the hook 'plot.new' doesn't appear to be relevant to the lattice package. I was wondering if there is a alternative someone can suggest for use with the lattice package.

Example code:

library(lattice)
graphics.off()

myFunc <- function()
{

        mainTitle <<- 'Page 1'
}

setHook('plot.new', NULL, 'replace')
setHook('plot.new', myFunc)

mainTitle <- 'No hook called'
plot(1:10, main = mainTitle)

win.graph()
mainTitle <- 'No hook called'
xyplot(1:10 ~ 1:10, main = mainTitle)

setHook('plot.new', NULL, 'replace')

> sessionInfo()

R version 2.6.0 (2007-10-03)
i386-pc-mingw32

locale:
LC_COLLATE=English_United States.1252;LC_CTYPE=English_United States.1252;LC_MONETARY=English_United
States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252

attached base packages:

[1] stats     graphics  grDevices utils     datasets  methods  
[7] base     

other attached packages:
[1] lattice_0.16-5

loaded via a namespace (and not attached): [1] grid_2.6.0

-- 
View this message in context: http://www.nabble.com/setHook-and-lattice-tp15764144p15764144.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help_at_r-project.org 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.
Received on Fri 29 Feb 2008 - 18:12:57 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 29 Feb 2008 - 19:30:18 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive