[R] xyplot gets overplotted by plot
Prof Brian Ripley
ripley at stats.ox.ac.uk
Thu Oct 14 18:09:01 CEST 2004
On Thu, 14 Oct 2004, Henric Nilsson wrote:
> After having set par(mfrow = c(2, 2)) and switching between plot() and
> xyplot() using R 2.0.0 Patched (2004-10-13) under Windows 2000, the lattice
> plot gets overplotted. I also tried this under 1.9.1 Patched (2004-09-22),
> since this is the only older version I've got installed, and it did the
> same thing apart from that the overplotting now starts in the opposite
> lower corner.
I think that was a bug in 1.9.1.
> I'm having a hard time believing that this is the intended behaviour, but
> I've been proved wrong before... Try
I think you are wrong. 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.
> library(lattice)
> y <- x <- 1:10
> par(mfrow = c(2, 2))
> # plots on a new page
> plot(y ~ x)
> # plots on a new page
> xyplot(y ~ x)
> # overplotting occurs
> plot(y ~ x)
>
> for a reproducible example.
Why do you want to mix base and lattice graphics on the same device?
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).
--
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