【发布时间】: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 的答案。
-
把它发布为答案,我会打你的!