Follow-up question to this R Shiny: Vtree plot not rendering with Shiny
With this code I generate a vtree
htmlwidget. I would like to take a screenshot and save it in png.
For this I use shinyscreenshot
. But I only get a screenshot of all the rest but not the html_widget:
library(shiny)
library(vtree)
library(shinyscreenshot)
# Define UI ----
ui <- pageWithSidebar(
# App title ----
headerPanel("Cyl vtree"),
# Sidebar panel for inputs ----
sidebarPanel(
screenshotButton(selector = "body")
),
# Main panel for displaying outputs ----
mainPanel(
vtreeOutput("VTREE", height = "800px")
)
)
# Define server logic to plot ----
server <- function(input, output) {
output[["VTREE"]] <- renderVtree({
vtree(mtcars, "cyl")
})
}
shinyApp(ui, server)
I used firefox and edge browser.
This is maybe due to
shinyscreenshot
limitations. Using another package (capture
) works:This is the output: