title: Integrate plotly with shinydashboard
body: <p>I have used shiny for several small scale project and am now giving a try to the <a href="https://rstudio.github.io/shinydashboard/" rel="noreferrer">shinydashboard</a> package which looks rather promising. I also want to integrate interactive plot using plotly (although other libraries can be considered in the future).</p>
  
  <p>I have no problem running examples integrating plotly in shiny (<a href="https://plot.ly/r/shiny-tutorial/" rel="noreferrer">example</a>) but face problems when attempting to achieve a similar results with shinydashboard.</p>
  
  <p>For example, the code below (app.R) is not working properly.</p>
  
  <pre><code>library(shiny)
  library(shinydashboard)
  library(plotly)
  library(ggplot2)
  
  
  
  
  data(movies, package = "ggplot2")
  minx &lt;- min(movies$rating)
  maxx &lt;- max(movies$rating)
  
  
  #######
  ####### UI
  #######
  
  ui &lt;- dashboardPage(
  
    ############# Header
    dashboardHeader(title = "Test"),
  
    ############# Sidebar
    dashboardSidebar(
      sidebarMenu(
        menuItem("Dashboard", tabName = "dashboard", icon = icon("dashboard"))
      )
    ),
  
  
    ############# Dashboard body
    dashboardBody(
      # Boxes need to be put in a row (or column)
      fluidRow(
        box(plotOutput("plot1"), width=6, height=500),
        box(plotOutput("plot2"), width=6, height=500)
      )
    )
  )
  
  
  #######
  ####### Server
  #######
  
  
  server &lt;- function(input, output, session) {
  
  
  
    output$plot1 &lt;- renderPlot({
  
  
      # a simple histogram of movie ratings
      p &lt;- plot_ly(movies, x = rating, autobinx = F, type = "histogram",
                   xbins = list(start = minx, end = maxx, size = 2))
      # style the xaxis
      layout(p, xaxis = list(title = "Ratings", range = c(minx, maxx), autorange = F,
                             autotick = F, tick0 = minx, dtick = 2))
  
    })
  
    output$plot2 &lt;- renderPlot({
  
  
      hist(movies$rating, col="blue")
  
    })
  }
  
  
  shinyApp(ui, server)
  </code></pre>
  
  <p>The page is supposed to display two similar plots: one generated with plotly, the other with R base. The second one is displayed properly but the plotly one is displayed in Rstudio viewer panel. If I run the App on a terminal using the runApp() function, one webpage opens for the dashboard and another one using only for the plotly interactive plot.</p>
  
  <p>I have tried to create some reactive plots (plots change in function of the content of some shiny controls such as slide bars) and the plot opened either in the viewer or another browser window/tab is updated.
  So everything seems to work, the only problem is that the plotly plot is not inserted in the dashboard but in a different location (viewer or other tab), which, of course, is a problem.</p>
  
  <p>Despite of my research, I could not find a solution to the problem (or even people mentioning it...). Any clue?</p>