0

I have a venn diagram plot I'm trying to save, so I created a downloadHandler to save a .png as such:

 output$downloadPlot <- downloadHandler(
    filename = function() { paste0(input$title, '.png') },
    content = function(file) {
      png(file)
      par(mar=c(5,4,4,2) + 0.1)
      plotInput()
      dev.off()
    }
  )

However, the image from the download differs from right clicking the plot and selecting "Save Image As..." when opened in the browser. I want to re-create the behavior of the latter because it does comes out higher-res and does not cut off the labels as shown here:

Downloaded with right-click Downloaded with right click

Using the downloadHandler Download Handler

TomNash
  • 3,147
  • 2
  • 21
  • 57
  • I'd guess it has something to do with your `par()` setting there. It would be nice if you actually provided a minimal [reproducible example](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with data and your plotting code to make it clear to see what's going on. – MrFlick Aug 18 '16 at 01:53
  • `par(mar=c(5,4,4,2) + 0.1)` as is the default. You can use any example that has a `downloadHandler` and a plot output to see it. Add a [renderPlot to this example](http://stackoverflow.com/questions/14810409/save-plots-made-in-a-shiny-app) and save both images in the way I say. They're different sizes. – TomNash Aug 18 '16 at 02:01

0 Answers0