[英]R Shiny: Vtree plot not rendering with Shiny
How can I use vtree package in shiny?如何在 shiny 中使用 vtree package? The desired plot is not appearing when trying to render it from serverside.尝试从服务器端渲染时,没有出现所需的 plot。 My code:我的代码:
library(shiny)
library(vtree)
# Define UI ----
ui <- pageWithSidebar(
# App title ----
headerPanel("Cyl vtree"),
# Sidebar panel for inputs ----
sidebarPanel(),
# Main panel for displaying outputs ----
mainPanel(
plotOutput("plot1")
)
)
# Define server logic to plot ----
server <- function(input, output) {
output$plot1 <- renderPlot({
vtree(mtcars, "cyl")
})
}
shinyApp(ui, server)
This is a HTML widget.这是一个 HTML 小部件。 You have to use the function renderVtree
and vtreeOutput
.您必须使用 function renderVtree
和vtreeOutput
。
library(shiny)
library(vtree)
# Define UI ----
ui <- pageWithSidebar(
# App title ----
headerPanel("Cyl vtree"),
# Sidebar panel for inputs ----
sidebarPanel(),
# Main panel for displaying outputs ----
mainPanel(
vtreeOutput("VTREE")
)
)
# Define server logic to plot ----
server <- function(input, output) {
output[["VTREE"]] <- renderVtree({
vtree(mtcars, "cyl")
})
}
shinyApp(ui, server)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.