require("ggplot2")
shinyServer(function(input, output, session) {
values <- reactiveValues(
plot = NULL
)
values$plot<- qplot(clarity, data=diamonds, fill=cut, geom="bar")
output$plot<- renderPlot(values$plot)
observeEvent(input$savePlot, {
image=values$plot
ggsave(file="test.svg", plot=image, width=10, height=8)
})
}