title: lattice plots not working inside a function
body: <p>I have this R code, which works perfectly and i get the bitmap with the plot if i run it in R console or as a RScript</p>
  
  <pre><code>library(DBI);
  library(RMySQL);
  library(brew);
  library(lattice);
  con &lt;- dbConnect(MySQL(),server credentials)
  x &lt;- dbGetQuery(con,"SELECT name, distance FROM distances")
  bitmap("/tmp/dist_6078.bmp")
  dotplot(x$distance~x$name, col='red', xlab='name', ylab='distance', main='Distance plot')
  dev.off()
  </code></pre>
  
  <p>Issue is, i am getting a blank image if i enclose everything between &lt;% and %> and use brew library. Everything works fine if i use basic R plots, issue is only when i use lattice.</p>