title: write plots to png file
body: <p>I can use ggplot2 to store the output of ggplot command to an object and call that object within grid.arrange to write to a file in an R script, as below:</p>
  
  <pre><code>p&lt;-ggplot(x, aes(x=Date, y=Date)) + geom_bar(aes(x=Date,y=Data)
  
  png("data.png", height=700, width=650)
  
  grid.arrange(p, main=textGrob("Data"), gp=gpar(cex=2)               
  
  dev.off()
  </code></pre>
  
  <p>I am creating bunch of forecast graphs using plot but I cannot do the same thing. Any one has any suggestion how can I write the ouput of plot to a png file in a script?</p>