title: Convert ggplot object to plotly in shiny application
body: <p>I am trying to convert a ggplot object to plotly and show it in a shiny application. But I encountered an error "no applicable method for 'plotly_build' applied to an object of class "NULL""</p>
  
  <p>I was able to return the ggplot object to the shiny application successfully, </p>
  
  <pre><code>output$plot1 &lt;- renderplot({
     gp &lt;- ggplot(data = mtcars, aes(x = disp, y = cyl)) + geom_smooth(method = lm, formula = y~x) + geom_point() + theme_gdocs()
  })
  </code></pre>
  
  <p>but somehow plotly cannot convert it. </p>
  
  <p>My code looks like this </p>
  
  <pre><code>output$plot2 &lt;- renderplotly({
     gp &lt;- ggplot(data = mtcars, aes(x = disp, y = cyl)) + geom_smooth(method = lm, formula = y~x) + geom_point() + theme_gdocs()
     ggplotly()
  })
  </code></pre>