Tomas Alonso Rehor
Tomas Alonso Rehor

Reputation: 265

Basic shiny not rendering plot

I have this shiny code and the plot is not showing for some reason. Can you please extend me a hand? Is a basic shiny plot to render in the Main Panel. Checked loads of times and still not plotting.

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)

Upvotes: 0

Views: 726

Answers (1)

MLavoie
MLavoie

Reputation: 9876

I have seen this same mistake a few time already.

plotlyOutput() should be used, not plotOutput()

Upvotes: 2

Related Questions