title: trying to remove all margins so that plot region comprises the entire graphic
body: <p>I am trying to remove all margins and the "figure region" of a plot in R, so that the plot region comprises the entire graphic device.  I thought the code below would do it, but there is still a border around my plot (wider on left/bottom, thinner on top/right).  Thanks </p>
  
  <pre><code>par(oma=c(0, 0, 0, 0))
  par(mar=c(0, 0, 0, 0))
  par(plt=c(0, 1, 0, 1))
  </code></pre>
  
  <p>Thought I would add a picture to show my progress.  The xaxs and yaxs removed nearly all border from the top and right- there is still a border on the left and bottom. </p>
  
  <p><img src="https://i.stack.imgur.com/kWDOd.png" alt="R plot"></p>
  
  <p>The relevant portion of my script is below.  </p>
  
  <pre><code>png("Test.png", 
       width = 256, height = 256,
       units = "px", pointsize = 6.4, 
       bg = "black", res = NA)
  
  par(mar=c(0, 0, 0, 0), xaxs='i', yaxs='i')
  
  
  smoothScatter(lhb$px, lhb$pz, nrpoints=0, xlim=c(-3,3), ylim=c(0,5), 
      main="", xlab="", ylab="", axes=FALSE, 
      colramp=colorRampPalette(c("black", "#202020", "#736AFF", "cyan", "yellow", "#F87431", "#FF7F00", "red", "#7E2217"))
      )
  
  segments(.83, 1.597, .83, 3.436, col = par("fg"), lty = par("lty"), lwd = par("lwd"))
  segments(-.83, 1.597, -.83, 3.436, col = par("fg"), lty = par("lty"), lwd = par("lwd"))
  segments(-.83, 3.436, .83, 3.436, col = par("fg"), lty = par("lty"), lwd = par("lwd"))
  segments(-.83, 1.597, .83, 1.597, col = par("fg"), lty = par("lty"), lwd = par("lwd"))
  
  
  dev.off()
  </code></pre>