title: Export figure to TIFF with specific format parameters
body: <p>I am trying to export figures for a paper that adhere to a journal's requirements, which are: <code>TIFF</code> format, figure's <code>width=180mm</code>, <code>resolution=900 dpi</code> and <code>compression="lzw"</code>. I have tried various ways to export and the one below seems to be the best one to honor both resolution and size. However, the script I wrote does not export the image properly.</p>
  
  <pre><code># sample data
  data &lt;- data.frame(x=gl(2,50), y=rnorm(100))
  
  # the graph
  p &lt;- ggplot(data, aes(x, y)) + geom_boxplot()
  p
  
  #sizes are in inches (180mm=7.087inches).
  dpi = 900
  tiff(".../test.tiff", width = 7,087*dpi, height = 3.825*dpi, compression="lzw", units="px", res=dpi)
  p
  dev.off()
  </code></pre>
  
  <p>Note: The figure export works well when I lower the width value to <code>width = 6.654*dpi</code> but that doesn't conform to the requirements.</p>