[R] [FORGED] what is the expected behavior of layout.show(n)

Yousri Fanous you@r|@|@nou@ @end|ng |rom gm@||@com
Wed Apr 29 23:49:20 CEST 2020


Thank you

Yousri

On Wed, Apr 29, 2020 at 5:12 PM Paul Murrell <paul using stat.auckland.ac.nz>
wrote:

> Hi
>
> This behaviour is as expected.
>
> The layout.show() function is just there to help visualise what the
> layout will look like.
>
> So for testing purposes, you would do something like ...
>
> layout(...)
> layout.show(n)
>
> Then to actually use the layout, you would do something like ...
>
> layout(...)
> plot(...)
> plot(...)
> plot(...)
>
> Paul
>
> On 30/04/20 1:09 am, Yousri Fanous wrote:
> > This works as expected: Histograms 1-3 are displayed on the first row and
> > histograms 4 and 5 on the second row
> >
> > However when I use layout.show to check the layout , it appears that
> > layout.show(3) consumes the first 3 locations
> >
> >> layout(matrix(c(1,1,2,2,3,3,0,4,4,5,5,0),2,6,byrow=T),respect=F)
> >> layout.show(3)
> >> hist(sample[,1],main="Hist for sample I",xlab="sample 1",ylab="freq")
> >> hist(sample[,2],main="Hist for sample II",xlab="sample 2",ylab="freq")
> >> hist(sample[,3],main="Hist for sample III",xlab="sample 3",ylab="freq")
> >> hist(sample[,4],main="Hist for sample IV",xlab="sample 4",ylab="freq")
> >> hist(sample[,5],main="Hist for sample V",xlab="sample 5",ylab="freq")
> > Now the first row shows 3 empty rectangles and histogram 1 and 2 are
> > displayed on row 2 while histograms 3-5 are displayed on the top row in a
> > different graph / page
> >
> > If I use layout.show(5) then each histogram is displayed on a separate
> > sheet as if the layout was fully consumed
> >
> > Few questions here:
> > 1) in case of layout.show(3) why the layout was still remembered /
> recycled
> > 2) with layout.show(5) why was the layout totally dismissed. I expected
> at
> > least it would restart over with 3 graphs in first row and 2 graphs in
> > second row to be consistent in behavior with layout.show(3)
> > 3) layout.show(x) purpose is to check if my layout is correct. It must
> not
> > leave any side effect on the main plots.
> >  From the help of function layout this line relates to layout.show
> >
> > layout.show(n) plots (part of) the current layout, namely the outlines of
> > the next n figures.
> >
> > It does not describe the behavior I am seeing
> >
> > 4) Finally is there a way to undo the effect of layout.show except
> re-enter
> > my layout again?
> >
> > Yousri
>
> --
> Dr Paul Murrell
> Department of Statistics
> The University of Auckland
> Private Bag 92019
> Auckland
> New Zealand
> 64 9 3737599 x85392
> paul using stat.auckland.ac.nz
> http://www.stat.auckland.ac.nz/~paul/
>

	[[alternative HTML version deleted]]



More information about the R-help mailing list