Open vnijs opened 6 years ago
I'm also interested in this. Is anyone working on it? If not, I'd be happy to try, but may needs some tips on how to get started.
It's a bit of bolierplate, but just FYI, this is possible with a combination of renderImage()
and the new htmltools::capturePlot()
function:
library(shiny)
ui <- fluidPage(
imageOutput("p")
)
renderSVG <- function(expr, width = 8, height = 3.75, ...) {
file <- htmltools::capturePlot(
expr, tempfile(fileext = ".svg"),
grDevices::svg,
width = width, height, ...
)
renderImage(list(src = file), deleteFile = TRUE)
}
server <- function(input, output, session) {
output$p <- renderSVG({
plot(pressure)
})
}
shinyApp(ui, server)
Adding an argument to renderPlot for the device type to use, png or svg, would be very nice