【问题标题】:Basic shiny not rendering plot基本闪亮不渲染情节
【发布时间】:2016-03-07 09:53:32
【问题描述】:

我有这个闪亮的代码,但由于某种原因,情节没有显示。你能帮我一把吗? 是要在主面板中渲染的基本闪亮图。检查了很多次,但仍然没有绘图。

library(shiny)
library(plotly)
library(ggplot2)

ui <- fluidPage(
  (titlePanel("APP & MEP | Size (m2) ~ Hours", windowTitle = "app")),

  sidebarLayout( 
    sidebarPanel(
      checkboxGroupInput(inputId = "checkgroup",
                         label = "Select Deparments",
                         choices = c("All", "ELE", "HVAC", "MAN", "PH", "LV"),
                         selected = "All", inline = F),
      radioButtons(inputId = "radio", 
                   label =  "ADD Stat_Smooth?", 
                   choices = c("YES","NO"), 
                   inline = T),
      sliderInput(inputId = "slider",
                  label = "SPAN Setting", 
                  min = 0.2, max = 2, value = 1,
                  ticks = T)
    ),

    mainPanel(plotOutput(outputId = "plot33"))
  )
)


server <- function(input, output){

  output$plot33 <- renderPlotly({

    gg <- ggplot(sizedf, aes(SIZE, Hours)) + geom_point(aes(color = Department)) + ggtitle("Size(m2) vs Hours per department")

    p <- ggplotly(gg)
    p
  })
}

shinyApp(ui = ui, server = server)

【问题讨论】:

  • 不确定我是否收到了您遇到的错误,但找不到对象 'sizedf' 告诉我您没有在示例中加载数据集。
  • 但是结构还可以吗?
  • 在你的 ui.R plotOutput 应该被 plotlyOutput 替换
  • 加一个 @MLavoie 的答案。
  • 把它发布为答案,我会打你的!

标签: r plot shiny


【解决方案1】:

同样的错误我已经见过几次了。

应该使用plotlyOutput(),而不是plotOutput()

【讨论】:

    猜你喜欢
    • 2021-06-19
    • 2018-01-31
    • 2018-01-25
    • 1970-01-01
    • 1970-01-01
    • 2015-01-11
    • 2016-06-12
    • 1970-01-01
    • 2016-01-11
    相关资源
    最近更新 更多