[R] multiple plots with par mfg

Romain Francois francoisromain at free.fr
Tue May 23 22:47:44 CEST 2006


Hi,

An other possibility might be to use two devices and use dev.set to go 
from one to another :

x11() # the first device (may be windows() or quartz() depending on you OS)
plot(1,1, col="blue") # blue plot
x11() # the second
plot(1.2,1.2, col="red") # red plot
points(1.1,1.1) # appears to bottom left of red point

dev.set(dev.prev()) # switch plots
points(1.1,1.1)

Le 23.05.2006 17:54, Yan Wong a écrit :
> 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
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>
>
>   


-- 
visit the R Graph Gallery : http://addictedtor.free.fr/graphiques
mixmod 1.7 is released : http://www-math.univ-fcomte.fr/mixmod/index.php
+---------------------------------------------------------------+
| Romain FRANCOIS - http://francoisromain.free.fr               |
| Doctorant INRIA Futurs / EDF                                  |
+---------------------------------------------------------------+



More information about the R-help mailing list