title: Plotly not working properly within R shiny App
body: <p>I am trying to show a plot chart after the button is clicked, which means the chart will only show up when the button is clicked, but the chart is just not showing up... any clue with this? Here is the code:</p>
  <pre><code>shinyApp(
    ui = fluidPage(
      sidebarLayout(
        sidebarPanel(
          actionButton(&quot;button&quot;, &quot;Show Chart&quot;)
        ),
        mainPanel(
          plotOutput(&quot;bar&quot;)
        )
      )
    ),
    server = function(input, output) {
      observeEvent(input$button, {
        category &lt;- c('task1', 'task2', 'task2','task1','task1')
        start_min &lt;- c(0, 0, 16, 45, 40)
        stop_min &lt;- c(14.9,18.8,17.5,65.5, 70)
        group &lt;- c('A', 'B', 'A', 'A', 'B')
        data &lt;- data.frame(category,start_min,stop_min,group)
        
        task_bars &lt;- ggplot(data, mapping=aes(ymin=0, ymax=1,
                                              xmin=start_min, xmax=stop_min,
                                              fill=as.factor(category),
                                              text=paste(&quot;Task:&quot;, str_wrap(string = category, width = 70,),
                                                         &quot;&lt;br&gt;Start: &quot;, format(start_min, digits=1), &quot;min&quot;, 
                                                         &quot;&lt;br&gt;Stop: &quot;, format(stop_min, digits=1), &quot;min&quot;)
        )) +
          geom_rect(alpha=0.8) +
          theme_minimal()+
          theme(
            axis.title.x=element_text(color=&quot;white&quot;), axis.text.x=element_text(color=&quot;white&quot;),
            axis.text.y=element_blank(), axis.ticks.y=element_blank(),
            panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
            panel.border = element_blank(), panel.background = element_blank()) +
          scale_fill_discrete(breaks=data$category)
        
        task_bars &lt;- plotly::ggplotly(task_bars, tooltip=&quot;text&quot;, width = 970, height = 120) %&gt;%
          plotly::config(displayModeBar = TRUE) %&gt;% 
          plotly::layout(plot_bgcolor='black', paper_bgcolor='black', margin = list(b=30, l=0, r=10, t=30))
        
        print(task_bars)
        output$bar &lt;- renderPlotly(task_bars)
      })
    }
  )
  </code></pre>