Cut/paste graphics as high quality

Can someone guide me towards how to set up something that would allow a user to cut and paste a higher-quality graphic from a Shiny app?

I am sometimes using ggplot2 and other times the native graphics (I can switch to ggplot2 for everything if that is easier). I envision something like double-clicking on a graphic to copy a scalable higher-res version like svg or a metafile. I have found information on how to save high-quality graphics in RStudio but not how that would work in an app.


Hi, welcome!

To help us help you, could you please prepare a reproducible example (reprex) illustrating your issue? Please have a look at these resources, to see how to create one for a shiny app

Well a reprex could be the default Old Faithful app. Right-click on the graph, copy, and it is at screen resolution. I am looking for a way to copy and paste this as a metafile, svg or other scalable high-res format?


ui <- fluidPage(

titlePanel("Old Faithful Geyser Data"),

                    "Number of bins:",
                    min = 1,
                    max = 50,
                    value = 30)



server <- function(input, output) {

output$distPlot <- renderPlot({
    x    <- faithful[, 2]
    bins <- seq(min(x), max(x), length.out = input$bins + 1)

    hist(x, breaks = bins, col = 'darkgray', border = 'white')


shinyApp(ui = ui, server = server)

I suggest you implement this approach with a shiny download button

Here's a relevant answer in stack overflow with many upvotes:

Thanks for the help. I can figure out how to save the file (thanks for the pointers). Is there no way to copy/paste the file in high-quality short of saving it?

This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.