[R] graphics reset

Duncan Murdoch dmurdoch at pair.com
Mon Nov 17 00:24:56 CET 2003


On Sun, 16 Nov 2003 17:19:29 -0500, you wrote:

>
>
>Hello,
>
>Is there a specific command to clear the graphics window. On occasion I
>need to construct plots using commands that don't clear the graphics
>window (like text, lines and points etc.) -only- and hence need to clear
>the graphics completely before hand. 

frame() or plot.new() will move to the next frame.  By default,
there's only one frame, but calls like par(mfrow=c(2,2)) set up more
frames on a single page.

>also, is there a way to restore the graphics parameters to default
>values, say in these cases where you forgot to save the original values
>and want to restore the graphics to some sane state after a long R
>session.

The easiest way is to use dev.off() to close the graphics window and
then start plotting to open a fresh new one, with default settings.

Duncan Murdoch




More information about the R-help mailing list