title: Remove border in ggplot2
body: <p>I would like to remove the white border in a <strong>.png</strong> output file, using <code>ggplot2</code>.
  I'm using Windows 10 with Rstudio, <code>ggplot2</code>, and <code>geom_raster</code>. After spending time searching on forums, and playing with some parameters, I ended up with this codes (that still does not work): </p>
  
  <pre><code>library(ggplot2)
  library(datasets)
  
  png(file = "Out.png")
  
  par(mar=rep(0, 4), plt=c(0.1,0.9,0.1,0.9), xpd=NA)
  
  ggplot(faithfuld, aes(waiting, eruptions)) +
  geom_raster(aes(fill = density))+
  theme(axis.line        = element_blank(),
        axis.text        = element_blank(),
        axis.ticks       = element_blank(),
        axis.title       = element_blank(),
        panel.background = element_blank(),
        panel.border     = element_blank(),
        panel.margin = unit(0,"null"),
        legend.position = "none",
        panel.grid.major = element_blank(),
        panel.grid.minor = element_blank(),
        plot.background  = element_blank(),
        plot.margin = rep(unit(0,"null"),4))
  
  dev.off()
  </code></pre>
  
  <p>This code gives this png:</p>
  
  <p><a href="https://i.stack.imgur.com/2oVO5.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2oVO5.png" alt="enter image description here"></a></p>