use of split.screen (was [R] Graphics question)

Prof Brian D Ripley ripley at
Sat May 18 09:09:51 CEST 2002

On Sat, 18 May 2002, Peter Hovmand wrote:

> I'm learning R and having some trouble clearing a screen. I'm
> using Version 1.5.0 and have encountered the same problem under Linux (RH7.2)
> and Windows (2K). For example:
> > split.screen(c(2,2))
> > plot(1:10)
> > screen(2)
> > plot(10:1)
> > erase.screen(1)
> > screen(1)
> > plot(10:1)
> What should I be expecting to happen? At the moment, it overlays the plots on
> screen 1. I've run through the example in the documentation under screen and
> it also seems to overlay plots. I've also tried setting new=TRUE when setting
> the screen, but that hasn't helped. What I would like to do (and was
> expecting) was that a new plot would clear that particular screen (e.g.
> screen 1 in the example above) instead of overlaying it.
> Most of the other things that I've tried have worked nicely. Any help would
> be appreciated. Perhaps there is a better text/reference for this specific
> question?

You haven't told us the device, but my bet is that you are using a screen
device with a transparent background, where `erase' does nothing.
R cannot really erase, only over-paint in the background colour.

Try par(bg="white") first.

I'll add a note on the help page.

Brian D. Ripley,                  ripley at
Professor of Applied Statistics,
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

r-help mailing list -- Read
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at

More information about the R-help mailing list