Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>One issue is fundamentally not getting what <code>plt</code> does. From <code>?par</code> we have:</p> <pre><code> ‘plt’ A vector of the form ‘c(x1, x2, y1, y2)’ giving the coordinates of the plot region as fractions of the current figure region. </code></pre> <p>So your plot region is of zero size if you do <code>par(plt=c(1, 1, 1, 1))</code>, so that doesn't seem to be the way to go. This is because the figure region <em>contains</em> the plot region.</p> <p>This plot seems to cover the entire region, without any margins:</p> <pre><code>op &lt;- par(mar = rep(0, 4)) plot(1:10) par(op) </code></pre> <p>it covers it so well you can't see the axes or the box:</p> <p><img src="https://i.stack.imgur.com/uO8se.png" alt="full region covered"></p> <p>This assumes the default for 0 outer margin (<code>oma</code>). Is this what you were looking for?</p> <p>We can see that just adjusting the plot margins, as above, we also change the <code>plt</code> parameter as a side effect:</p> <pre><code>&gt; par("plt") [1] 0.1173174 0.9399106 0.1457273 0.8828467 &gt; op &lt;- par(mar = rep(0, 4)) &gt; par("plt") [1] 0 1 0 1 &gt; par(op) &gt; par("plt") [1] 0.1173174 0.9399106 0.1457273 0.8828467 </code></pre> <p>indicating that simply setting the plot margins is sufficient to get a plot/figure region encompassing the entire device.</p> <p>Of course, there is still a bit of internal padding that insures the ranges of the axes are slightly large than the range of the data in both the <code>x</code> and <code>y</code> coordinates. But you can control this with <code>xaxs</code> and <code>yaxs</code> --- see <code>?par</code></p> <p><strong>Update:</strong> As the OP has shown the sort of figure they are trying to produce without margins, I can provide a reproducible example:</p> <pre><code>set.seed(1) dat &lt;- matrix(rnorm(100*100), ncol = 100, nrow = 100) layout(matrix(1:2, ncol = 2)) image(dat) op &lt;- par(mar = rep(0, 4)) image(dat) par(op) layout(1) </code></pre> <p>which gives for comparison:</p> <p><img src="https://i.stack.imgur.com/t1cLz.png" alt="comparison of default and no margins respectively"></p> <p>and showing just the full plotting region:</p> <p><img src="https://i.stack.imgur.com/jRh3U.png" alt="full plot region covered"></p>
 

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