Description Usage Arguments Value Author(s) Examples
View source: R/dq_render_svg.R
Returns ggplot2 svg image for shiny::imageOutput
1 2 3 4 5 6 7 8 9 10  | 
gg | 
 reactive or non-reactive ggplot2 object  | 
path | 
 directory where images are stored (optional, default = NULL, creates tmp files)  | 
width | 
 plot width (optional, default = 1200)  | 
height | 
 plot height (optional, default = 500)  | 
alt | 
 alternative image title (optional, default = "")  | 
pdf | 
 boolean variable controlling if pdf output is generated (optional, default = FALSE)  | 
png | 
 boolean variable controlling if png output is generated (optional, default = FALSE)  | 
delete_file | 
 parameter for shiny::renderImage function  | 
list containing ggplot2 figure information
david.breuer
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20  | ## Only run examples in interactive R sessions
if (interactive()) {
library(shiny)
shinyApp(
  ui = fluidPage(
    selectInput("select","Number of bars", choices=c(4,5,6)),
    br(),
    imageOutput("plot")
  ),
  server = function(input, output) {
    gf <- reactive({L <- as.integer(input$select)
                    gg <- ggplot2::ggplot(data=data.frame(x=seq(L), y=seq(L)),
                      ggplot2::aes(x=x, y=y)) + ggplot2::geom_bar(stat = "identity")
    })
    output$plot <- dq_render_svg(gf)
  }
)
}
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.