[R] multiple plots with par mfg

Yan Wong H.Y.Wong at leeds.ac.uk
Tue May 23 14:04:51 CEST 2006


On 23 May 2006, at 12:48, Prof Brian Ripley wrote:

> On Tue, 23 May 2006, Yan Wong wrote:
>> if not, can anyone suggest a way of appending to 2
>> separate plots on the fly.
>
> No, it is user error.  par(mfg=) specifies where the next figure  
> will the drawn, and points() does not draw a figure but adds to  
> one. As the help page says:
>
>      'mfg' A numerical vector of the form 'c(i, j)' where 'i' and 'j'
>           indicate which figure in an array of figures is to be drawn
>           next (if setting) or is being drawn (if enquiring).
>           ^^^^

OK. I didn't appreciate the distinction between drawing and adding.

> You need to use screen() or layout() to switch back to an existing  
> plot.

Thanks, but the help page for screen says "The behavior associated  
with returning to a screen to add to an existing plot is  
unpredictable and may result in problems that are not readily  
visible." I assume this to mean that I shouldn't do it using screen().

I can't find any description of how to add points to several  
different plots generated after a layout() call. Is there a way?

Cheers

Yan



More information about the R-help mailing list