[R] Lattice not plotting within loop

ripley@stats.ox.ac.uk ripley at stats.ox.ac.uk
Mon Feb 3 13:56:03 CET 2003


This discussed almost daily.

You *print* a trellis/lattice plot, and no printing is done in your 
example.

On Mon, 3 Feb 2003 Ted.Harding at nessie.mcc.ac.uk wrote:

> Something I don't understand ... (!)

It's in all good books on S/R ....

> With the lattice library loaded, I have a loop
> 
>   for( Z in ... ) {
>   ...
>   xyplot(y~x | t, xlab=..., ylab=... )
>   }
> 
> and no plot appears on the R graphics device.
> However, when I run the commands within {...}
> separately for each instance of Z, I get the
> plot displayed each time.
> 
> So it looks as though "xyplot" is not outputting
> to the graphics display when invoked within a loop.

It never does.  print.trellis does the outputting.

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list