Skip to content

renderPlotly() doesn't appear in bs_accordion_item #11

Description

@Lmudge13

Thanks for this package! I am using the bs_accordion and bs_accordion_item functions from this package and haven't been able to get outputs with renderPlotly() to appear in the accordion item, but outputs created with renderPlot() work fine. Any idea why? Example below:

ui <- navbarPage(
  theme = bs_theme(version =4, bootswatch = "solar"),
           fillPage(
             absolutePanel(id = "controls",
                           fixed = TRUE, draggable = TRUE,
                           top = 110, left = "auto", right = 35, bottom = "auto",
                           width = 800, height = "auto",
                      bs_accordion(
                        id = "accordion",
                        items = tagList(
                          bs_accordion_item(
                            title = "gg plot",
                            plotOutput("plot_gg"),
                            active = TRUE
                          ),
                          bs_accordion_item(
                            title = "ggplotly",
                            plotlyOutput("plot_ggplotly") 
                          ),
                          bs_accordion_item(
                            title = "plot_ly",
                            plotlyOutput("plot_plotly")
                          )
                        )#taglist
                      )#bs_accordion
                      ) #absolutePanel
           )#fillPage

)

server <- function(input, output, session) {
  
  output$plot_gg <- renderPlot({
    ggplot(pressure, aes(x = temperature, y = pressure)) + geom_line() + geom_point()
  })
  
  output$plot_ggplotly <- renderPlotly({
    p <- ggplot(pressure, aes(x = temperature, y = pressure)) + geom_line() + geom_point()
    ggplotly(p)
  })
  
  output$plot_plotly <- renderPlotly({
    plot_ly(data = pressure, x = ~temperature, y = ~pressure) %>%
      add_lines()
  })
}

shinyApp(ui=ui, server=server)


Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions