Luigi Marongiu
2021-Oct-21 21:00 UTC
[R] Split plot panel into rows with different columns
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
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 at 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 at 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]]