[R] Question about using “par”

Charilaos Skiadas cskiadas at gmail.com
Thu Nov 29 17:40:14 CET 2007


On top of which, you should expect a setting of mfrow=c(1,2) like you  
have to only allow you to put two figures in 1 row and 2 columns.

Haris Skiadas
Department of Mathematics and Computer Science
Hanover College

On Nov 29, 2007, at 9:35 AM, Dieter Menne wrote:

> cathelf <cathelf <at> hotmail.com> writes:
>
>> Sorry for bothering your guys again. I am trying to use "par" to  
>> put 6
>> figures into 3 rows and 2 columns. My code is:
>>
>> op <- par(mfrow = c(1, 2))
>> xyplot(x1+x2+x3 ~ y, data=resulta, type="l", pch=LETTERS[1:3],  
>> lty=c(1:3),
>> main="For k=3, theata1=1")
>> xyplot(x1+x2+x3  ~ y, data=resultb, type="l", pch=LETTERS[1:3],  
>> lty=c(1:3),
>> main="For k=3, theata1=5")
> ....
>>
>> But I can only get one figure in one page, not 6 figures in one  
>> page. Is
>> there any other parameter I should specify? There is no error  
>> indicated.
>
> Rule of thumb: what's documented under the header trellis or  
> lattice does not
> use par.
>
> xyplot is a lattice/trellis function, which does not honor par(...)  
> settings,
> but uses package grid for layout and everthing else.
>
> So either use standard plot
>   plot(rnorm(100),rnorm(100))
>
> or do something like:
>
> p = xyplot(whatever....)
> print(p,split=c(1,1,2,2), more=TRUE)
> p = xyplot(whoever,...
> print(p,split=c(1,2,2,2), more=TRUE)
>
> See print.trellis for details.
>
> Dieter



More information about the R-help mailing list