Note that there are some explanatory texts on larger screens.

plurals
  1. POCombining leveragePlots()
    primarykey
    data
    text
    <p>Good Morning,</p> <p>Am new to R. I am trying to combine 9 plots, arranging it to 3 x 3.</p> <p>I have a) 7 leveragePlots() syntax that creates 1 plot each,and b) the 8th leveragePlots() generates 2 plots as it is two variable linear model fit.</p> <p>When using the below, the first 7 plots where arranged well, but the last one does not fit into the 3x3 grid but opens a new window with 2 plots.</p> <p>Minimal Dataset (sample.txt):</p> <pre><code>X Y 276.67 5.20 285.00 5.17 296.67 4.96 307.50 5.26 307.50 5.11 262.50 5.27 278.33 5.20 282.50 5.16 267.50 5.17 250.00 5.20 275.00 5.18 274.17 5.09 311.67 5.03 294.17 5.21 279.17 5.29 300.00 5.14 292.50 5.09 297.50 5.16 290.00 4.99 272.50 5.23 289.17 5.32 279.17 5.21 325.83 5.14 292.50 5.22 255.83 5.15 290.83 5.09 283.33 5.09 284.17 5.07 298.33 5.27 269.17 5.19 </code></pre> <p>Tried using <em>par(mfrow=c(3,3))</em> and also <em>layout(matrix(c(1,2,3,4,5,6,7,8,8), 3, 3, byrow = TRUE))</em>. It is not working. Still opening new window for the last syntax of leveragePlots(). To replicate the codes are below,</p> <pre><code>library(car) sampledata &lt;- read.table("D:/sample.txt", header=TRUE) y.1 &lt;- sampledata$Y x.1 &lt;- sampledata$X x.2 &lt;- (sampledata$X)^2 par(mfrow=c(3,3)) leveragePlots(lm(y.1 ~ x.1)) leveragePlots(lm(y.1 ~ x.1)) leveragePlots(lm(y.1 ~ x.1)) leveragePlots(lm(y.1 ~ x.1)) leveragePlots(lm(y.1 ~ x.1)) leveragePlots(lm(y.1 ~ x.1)) leveragePlots(lm(y.1 ~ x.1)) leveragePlots(lm(y.1 ~ x.1 + x.2)) </code></pre> <p>Do you know how I can force the final 2 plots to be placed in the same 3x3 layout? If you do, please advice me.</p> <p>Am currently reading on layout() at <a href="http://rfunction.com/archives/1538" rel="nofollow">http://rfunction.com/archives/1538</a> ,not sure how to use this to achieve the above.</p> <p>Thanks for your lead.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload