[R] Nested layout()

baptiste auguie baptiste.auguie at googlemail.com
Fri Dec 17 09:35:22 CET 2010


Hi,

Also, see the gridbase package that gives you the flexibility of Grid viewports.

HTH,

baptiste

On 17 December 2010 09:33, Jim Lemon <jim at bitwrit.com.au> wrote:
> On 12/17/2010 02:00 PM, Dario Strbenac wrote:
>>
>> Hello,
>>
>> Is it possible to call a graphing function that uses layout() multiple
>> times and layout those outputs ? Here's a minimal example :
>>
>> myplot<- function()
>> {
>>        layout(matrix(1:2, nrow=1), widths = c(1, 1))
>>        plot(1:10)
>>        plot(10:1)
>> }
>>
>> layout(matrix(1:2), heights = c(1, 2))
>> myplot()
>> myplot()
>>
> Hi Dario,
> Try split.screen followed up by subplot in the TeachingDemos package.
>
> split.screen(c(2,2))
> screen(1)
> plot(1:10)
> subplot(plot(rnorm(5)),c(1,5),c(5,10))
> screen(2)
> plot(1:10)
> subplot(plot(rnorm(5)),c(1,5),c(5,10))
> screen(3)
> plot(1:10)
> subplot(plot(rnorm(5)),c(1,5),c(5,10))
>
> The final plots are left as an exercise.
>
> Jim
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



More information about the R-help mailing list