[R] Split plot panel into rows with different columns

Jim Lemon drj|m|emon @end|ng |rom gm@||@com
Fri Oct 22 04:31:28 CEST 2021


Hi Luigi,
Bert has identified the problem. If the ordinates in each row are the
same, you can save quite a bit of space by setting the left and right
margins to zero on all but the left plots in each row. This will jam
the plots together at the sides, but that may not matter to you.
Remember that you have to set the margins for each plot. If you do
this, it is usually better looking if you specify more room for the
leftmost panels.

Jim

On Fri, Oct 22, 2021 at 8:43 AM Bert Gunter <bgunter.4567 using gmail.com> wrote:
>
> The syntax is correct; the default margins are too large for your device.
>
> For example, using your split screen specs on the RStudioGD
>
> > split.screen(c(3, 1))       # split display into 3 screens
> [1] 1 2 3
> >
> > split.screen(c(1, 2), screen = 2) # split second screen into two columns
> [1] 4 5
> >
> > split.screen(c(1, 2), screen = 3) # split third screen into two columns
> [1] 6 7
> >
> > screen(1)
>
> > plot(1:10)
> Error in plot.new() : figure margins too large
> > par(mar = c(2,1,1,1))
> > plot(1:10)
> ## plots on screen 1
>
>
> Bert Gunter
>
> "The trouble with having an open mind is that people keep coming along and
> sticking things into it."
> -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
>
>
> On Thu, Oct 21, 2021 at 2:00 PM Luigi Marongiu <marongiu.luigi using gmail.com>
> wrote:
>
> > Hello,
> > I would like to draw 5 figures in the same plot. The layout is:
> >   first row: 1 column
> >   second row: 2 columns
> >   third row: 2 columns
> > I have used split.screen:
> > ```
> > > split.screen(c(3, 1))       # split display into 3 screens
> > [1] 1 2 3
> > > split.screen(c(1, 2), screen = 2) # split second screen into two columns
> > [1] 4 5
> > > split.screen(c(1, 2), screen = 3) # split third screen into two columns
> > [1] 6 7
> > > screen(1)
> > > plot(classified$MR[classified$Class == "positive"] ~
> > + classified$FCN[classified$Class == "positive"], cex=1.5, pch=16,
> > + xlim=c(0,50), ylim=c(0,0.45),
> > + xlab=expression(bold("FCN")), ylab=expression(bold("MR")))
> > Error in plot.new() : figure margins too large
> > ```
> > Is this the correct syntax? Then I simply plot into each of the 7
> > screens. So the error is about margins/
> > Or is it simply that the layout is not correct?
> > Thank you
> >
> > ______________________________________________
> > R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> > 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.
> >
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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