[R] Replacing 1 plot in layout

David Winsemius dwinsemius at comcast.net
Thu Nov 25 03:30:56 CET 2010

On Nov 24, 2010, at 8:24 PM, Kohleth Chia wrote:

> Hi,
> layout(1:2) # split the screen into 2 regions
> plot(1:2) # plot in region 1
> plot(1:2) # plot in region 2
> par(mfg=c(1,1)) # Then I want to update the plot in region 1

You cannot "replace" it with another plot (lattice is set up to doe  
that sort of operation)  but you can overwrite it:

mfcol, mfrow	A vector of the form c(nr, nc). Subsequent figures will  
be drawn in an nr-by-nc array on the device bycolumns (mfcol), or rows  
(mfrow), respectively.

> plot(1.5,1.5)
> But the this last plot overlays with my 1st plot.
> Q: How do I replace my first plot with my last?
> #### NOTE ######
> I know I can do this with split.screen and screen(n,TRUE)
> But then it actually clears the previous plot before plotting the  
> new one,
> which causes a 'white flash' if you know what I mean.
> Since I will be updating my plot at a fairly rapid rate (imagine  
> using a
> image sequence to emulate a video)
> The 'white flashing' definitely CANNOT be there.

Base graphics is probably not what you want. Have you looked at the  
animation package?
> -- 
> KC
> 	[[alternative HTML version deleted]]

Learn to post in plain text please.
David Winsemius, MD
West Hartford, CT

More information about the R-help mailing list