[R] xyplot gets overplotted by plot

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu Oct 14 19:33:49 CEST 2004

On Thu, 14 Oct 2004, Henric Nilsson wrote:

> At 17:09 2004-10-14 +0100, Prof Brian Ripley wrote:
> >You can't expect base graphics to know that you
> >have used a grid plot (via lattice) after the last base graphics plot and
> >did not intend to write on top of the latter.  Base graphics has been told
> >to write on the existing page of the device, in the upper right figure
> >region of an already divided device region.  So it does.
> OK. I got fooled by that it seems to 'work' if we repeatedly just switch 
> between xyplot and plot, i.e. without altering the par setting. But is that 
> just due to everything on the device getting overwritten? I assumed that 
> every call to plot erased the device before plotting.

Not if you partition the device (by par(mfrow/mfcol), layout, 
split.screen, etc).

> >Why do you want to mix base and lattice graphics on the same device?
> Convenience (if you define mixing as being able to direct all output from 
> both graphic systems to a single window without risking one getting 
> overlayed by the other).

Yes.  I use separate devices for base and lattice graphics: it is easy to 
switch between them using dev.*.  That's habit from when you had too.

> >Think of it as a bonus that it works at all (it has not always, and base
> >and Trellis interwork less well in S-PLUS).
> I think of whole of R as a bonus. Thanks for your reply!
> Henric 

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