title: Understanding png output settings
body: <p>I don't understand how I can arrange a plot to fill an image of a certain pixel size, with a specific font-size and a small margin. Here is an example plot:</p>
  
  <pre><code>library(ggplot2)
  
  a &lt;-c(1:10); b &lt;- c(1:10)
  p &lt;- qplot(a,b)
  outPath = "D:/Scratch/"
  
  # 1
  png(paste(outPath, '1.png', sep=''), height=400, width=400, res = 120, units = 'px')
  print(p); dev.off()
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/GRk5t.png" alt="enter image description here"></p>
  
  <pre><code># 2
  png(paste(outPath, '2.png', sep=''), pointsize = 20,height=400, width=400, res = 120, units = 'px')
  print(p); dev.off()
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/HbMeN.png" alt="enter image description here"></p>
  
  <pre><code># 3
  png(paste(outPath, '3.png', sep=''), height=400, width=400, res = 250, units = 'px')
  print(p); dev.off()
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/BVPdI.png" alt="enter image description here"></p>
  
  <p>I'm less concerned about the resolution of the image, but I want the font size to be large, in proportion to the overall image (similar to plot #3). The argument <code>pointsize</code> does not appear to result in any font size changes.I also want the border to be minimized. At the moment, if I use the settings on #3 there is a much larger space around the plot, when compared to the other images. How can I have a plot that has large font, with a small margin?</p>