Re: [R] setHook and lattice

From: Deepayan Sarkar <deepayan.sarkar_at_gmail.com>
Date: Sat, 01 Mar 2008 01:37:32 +0000

On 2/29/08, Prof Brian Ripley <ripley_at_stats.ox.ac.uk> wrote:
> See share/perl/massage-examples.pl
>
> Hint: lattice is a (very sophisticated) wrapper for grid, and it is
> grid.newpage() that has the hook.
>
> Hint 2: look at the version in the R-devel sources,
>
> https://svn.r-project.org/R/trunk/share/perl/massage-Examples.pl
>
> for use with lattice.
>
>
> On Fri, 29 Feb 2008, Jim Price wrote:
>
> >
> > 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.

Another solution is to use the 'page' argument. It takes its default from lattice.getOption("default.args")$page, so you could set something like

lattice.options(default.args = list(page = function(n) {

    panel.text(lab = sprintf("Page %d", n), x = 0.95, y = 0.05) }))

This would put page numbers starting from 1 for each plot, but you could easily use a global counter instead.

-Deepayan



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 Sat 01 Mar 2008 - 01:39:46 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 Sat 01 Mar 2008 - 03:30:17 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