[R] multiple plots with par mfg

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


On 23 May 2006, at 15:57, Greg Snow wrote:

> The best thing to do is to create the first plot, add everything to  
> the
> first plot that you need to, then go on to the 2nd plot, etc.

Yes, I realise that. The problem is that the data are being simulated  
on the fly, and I wish to display multiple plots which are updated as  
the simulation progresses. So I do need to return to each plot on  
every generation of the simulation.

> If you
> really need to go back to the first plot to add things after plotting
> the 2nd plot then here are a couple of ideas:
>
> Look at the examples for the cnvrt.coords function in the  
> TeachingDemos
> package (my quick test showed they work with layout as well as
> par(mfrow=...)).
>
> The other option is when you use par(mfg) to go back to a previous  
> plot
> you also need to reset the usr coordinates, for example:

Aha. I didn't realise that the usr coordinates could be stored and  
reset using par.

> Hope this helps,

I think that's exactly what I need. Thank you very much.

Yan



More information about the R-help mailing list