[R] Multiple lag.plots per page

Gad Abraham g.abraham at ms.unimelb.edu.au
Wed Jun 14 01:41:39 CEST 2006


Prof Brian Ripley wrote:
> On Tue, 13 Jun 2006, Gad Abraham wrote:
> 
>> Prof Brian Ripley wrote:
>>> On Tue, 13 Jun 2006, Gad Abraham wrote:
>>>
>>>> Hi,
>>>>
>>>> I'm trying to plot several lag.plots on a page, however the second plot
>>>> replaces the first one (although it only takes up the upper half as it
>>>> should):
>>>>
>>>> par(mfrow=c(2,1))
>>>> a<-sin(1:100)
>>>> b<-cos(1:100)
>>>> lag.plot(a)
>>>> lag.plot(b)
>>>>
>>>> What's the trick to this?
>>>
>>> lag.plot itself calls par(mfrow).  The trick is to get one call to do 
>>> the plots you want:
>>>
>>> lag.plot(cbind(a,b))
>>>
>>>
>>
>> Thanks, that works great for multiple lag.plots. Is it possible to 
>> have a lag.plot and another type of plot on the same page? The second 
>> plot() always replaces the lag.plot for me.
> 
> Yes, if the other plot is second, e.g
> 
> par(mfrow=c(2,1))
> a<-sin(1:100)
> lag.plot(a)
> par(mfg=c(2,1)) # move to second plot
> plot(1:10)
> 
> 

Thanks, works great.

Cheers,
Gad

-- 
Gad Abraham
Department of Mathematics and Statistics
University of Melbourne
Victoria 3010, Australia
email: g.abraham at ms.unimelb.edu.au
web: http://www.ms.unimelb.edu.au/~gabraham



More information about the R-help mailing list