title: Using Plotly in shinydashboard, buttons too large to see plot
body: <p>I'm using Plotly's tutorial for shiny in my shinydashboard app (<a href="https://plot.ly/r/shiny-tutorial/" rel="nofollow noreferrer">https://plot.ly/r/shiny-tutorial/</a>).</p>
  
  <p>For some reason, whenever I run the app and go to the Plotly tab, if I try to interact with the plot the buttons usually located on the top right of a Plotly plot become so large, they overshadow the plot.</p>
  
  <p><img src="https://i.stack.imgur.com/FXyxF.png" alt="Large buttons"></p>
  
  <p>Here is my ui code:</p>
  
  <pre><code>library(ggplot2)
  library(plyr)
  library(rCharts)
  library(shiny)
  library(xtable)
  library(shinythemes)
  library(shinydashboard)
  library(dplyr)
  library(plotly)
  PopData &lt;- read.csv("CountyPopLong.csv", header=T)
  ChangeData &lt;- read.csv("CountyChangeLong.csv", header=T)
  CountyPop &lt;- read.csv("CountyPopWide.csv", header=T)
  CountyChange &lt;- read.csv("CountyChangeWide.csv", header=T)
  CntyInfo &lt;- read.csv("CntyCensusInfo.csv", header=T)
  CityPop &lt;- read.csv("CityData.csv", header=T)
  CityPopLong &lt;- read.csv("CityPop.csv", header=T)
  CityChange &lt;- read.csv("CityChangeWide.csv", header=T)
  CityChangeLong &lt;- read.csv("CityChangeLong.csv", header=T)
  CityInfo &lt;- read.csv("CityCensusInfo.csv", header=T)
  TwpInfo &lt;- read.csv("TwpCensusInfo.csv", header=T)
  TwpPop &lt;- read.csv("TownshipPopWide.csv", header=T)
  TwpPopLong &lt;- read.csv("TownshipPopLongWithCounty.csv", header=T)
  TwpChange &lt;- read.csv("TwpChangeWide.csv", header=T)
  TwpChangeLong &lt;- read.csv("TwpChangeLong.csv", header=T)
  MHIdata &lt;- read.csv("CountyMHILong.csv", header=T)
  PCIdata &lt;- read.csv("CountyPCILong.csv", header=T)
  CityACS &lt;- read.csv("CityACSLong.csv", header=T)
  TwpACS &lt;- read.csv("TwpACSLong.csv", header=T)
  CountyBGLong &lt;- read.csv("CountyBG2000to2010long.csv", header=T)
  CityBGLong &lt;- read.csv("CityBG2000to2010long.csv", header=T)
  TwpBGLong &lt;- read.csv("TwpBrainGain2000to2010long.csv", header=T)
  CountyBG90Long &lt;- read.csv("CountyBG1990to2000long.csv", header=T)
  CityBG90Long &lt;- read.csv("CityBG1990to2000long.csv", header=T)
  TwpBG90Long &lt;- read.csv("TwpBrainGain1990to2000long.csv", header=T)
  options(RCHART_WIDTH=500, RCHART_HEIGHT=500)
  
  dashboardPage(
        header &lt;- dashboardHeader(
  
        title = "CST Datapage"
        ),
  
  
  
        dashboardSidebar(
          sidebarMenu(
            sidebarMenu(
              menuItem("County Table", tabName="County-Table"),
  
              menuItem("Township", tabName="Township",
                menuSubItem("Table", tabName = "Table"),
                menuSubItem("Chart", tabName = "Chart")
            ),
  
              menuItem("Plotly Stuff", tabName = "Plotly-Stuff")
          )),
  
        tags$head(
  
          tags$style(HTML("
                          .sidebar{height: 90vh; overflow-y: auto; }
                          .dataTables_wrapper { overflow-x: scroll; }
                          .rChart {height: 500px, width: 100%}
                          "))
        )  
  
        ),
  
        dashboardBody(
        tabItems(
        tabItem(tabName =  "Table",
  
                tabBox(
  
                title = "Township Table",
                id= "TwpPopTable", height = "5000px", width = "1000px",
                tabPanel("Download Data", 
                fluidPage(
                                absolutePanel(draggable=F, top=125, left = 250, width = "40.2%",
                                              sidebarPanel(
                                                helpText("The township data is organized by county. To view a specific townshipâs population, first select the county it is located. You can compare multiple townships by holding down âCTRLâ while selecting your desired counties."),
                                                selectInput("County4", 
                                                            "Select a County:", 
                                                            c("All", 
                                                              unique(as.character(TwpPop$County))),
                                                            selected = "All",
                                                            multiple = TRUE
                                                            #                                                                               , selectize = FALSE
                                                ),
                                                helpText("To download the full dataset in .csv format, click the button below. Customized data can also be copied and pasted into an Excel spreadsheet with the formatting intact."),
                                                downloadButton('twpPopDownload', label = "Download Data"),
                                                width = 12)))),
                tabPanel("Table", 
                                mainPanel(dataTableOutput(outputId="TwpPopTable"),
                                          p("Source: U.S. Census Bureau, Decennial Censuses 1900-2010"))
  
  
                 ))),
  
  
        tabItem((tabName = "Chart"),
  
                  fluidRow(  
                    column(width=5,
                        box(   
                        showOutput("TwpPopChart", "nvd3"), status= "primary",
                        p("Source: U.S. Census Bureau, Decennial Censuses 1900-2010")
                        , widths = c(1, 10))), 
  
                    absolutePanel(draggable=T, top=200, left = 1000, width = "20%",
                                  helpText("The township data is organized by county. To view a specific townshipâs population, first select the county it is located. You can compare multiple townships by holding down âCTRLâ while selecting your desired counties. Then select the communities you want to compare by clicking on the legend."),
                                  selectInput("County5", 
                                              "Select a County:", 
                                              c(unique(as.character(TwpPopLong$County))),
                                              selected = "Aitkin",
                                              multiple = TRUE
                                              #                                                                               , selectize = FALSE
                                  )))
  
        ),
  
        tabItem(
          (tabName = "County-Table"),
  
                h2("Ayyyyyy")
  
                ),
  
  
  
        tabItem(
          (tabName = "Plotly-Stuff"),
  
            fluidRow( 
            mainPanel(plotlyOutput("trendPlot", width="100%")),
  
  
            sliderInput("bins", "Numbner of bins:", min=1,max=50,value=10))
        )),
  
        #Below is for colors display of the 
  
        tags$head(tags$style(HTML('
                  .skin-blue .main-header .logo{
                    font-family: Georgia, Times, "Times New Roman", serif;
                    font-weight: bold;
                    font-size: 24px;
                    color: #FFFF1C;
                  }
  
                  .skin-blue .main-header .logo{
                    background-color: #FF9900;
                  }
  
                  .skin-blue .main-header .navbar{
                    background-color: #FF9900;
                  }
  
                  .skin-blue .main-sidebar{
                    background-color: #FF9900;
                  }
  
                  .skin-blue .main-sidebar{
                    font-family: Georgia, Times, "Times New Roman", serif;
                    font-weight: bold;
                    font-size: 12px;
                    color:#FFFF1C;
                  }
  
                  .skin-blue .main-sidebar .sidebar .sidebar-menu .active a{
                    color: #FFFF1C;
                  }
  
                  .skin-blue .main-header .logo:hover{
                    background-color: #FF9900;
                  }
  
                  ')
  
  
        ))
  
  ))
  </code></pre>
  
  <p>Here is my server code:</p>
  
  <pre><code>library(ggplot2)
    library(plyr)
    library(rCharts)
    library(shiny)
    library(xtable)
    library(RColorBrewer)
    library(shinythemes)
    library(shinydashboard)
    library(dplyr)
    library(plotly)
    PopData &lt;- read.csv("CountyPopLong.csv", header=T)
    ChangeData &lt;- read.csv("CountyChangeLong.csv", header=T)
    CountyPop &lt;- read.csv("CountyPopWide.csv", header=T)
    CountyChange &lt;- read.csv("CountyChangeWide.csv", header=T)
    CntyInfo &lt;- read.csv("CntyCensusInfo.csv", header=T)
    CityPop &lt;- read.csv("CityData.csv", header=T)
    CityPopLong &lt;- read.csv("CityPop.csv", header=T)
    CityChange &lt;- read.csv("CityChangeWide.csv", header=T)
    CityChangeLong &lt;- read.csv("CityChangeLong.csv", header=T)
    CityInfo &lt;- read.csv("CityCensusInfo.csv", header=T)
    TwpInfo &lt;- read.csv("TwpCensusInfo.csv", header=T)
    TwpPop &lt;- read.csv("TownshipPopWide.csv", header=T)
    TwpPopLong &lt;- read.csv("TownshipPopLongWithCounty.csv", header=T)
    TwpChange &lt;- read.csv("TwpChangeWide.csv", header=T)
    TwpChangeLong &lt;- read.csv("TwpChangeLong.csv", header=T)
    MHIdata &lt;- read.csv("CountyMHILong.csv", header=T)
    PCIdata &lt;- read.csv("CountyPCILong.csv", header=T)
    CityACS &lt;- read.csv("CityACSLong.csv", header=T)
    TwpACS &lt;- read.csv("TwpACSLong.csv", header=T)
    CountyBGLong &lt;- read.csv("CountyBG2000to2010long.csv", header=T)
    CityBGLong &lt;- read.csv("CityBG2000to2010long.csv", header=T)
    TwpBGLong &lt;- read.csv("TwpBrainGain2000to2010long.csv", header=T)
    CountyBG90Long &lt;- read.csv("CountyBG1990to2000long.csv", header=T)
    CityBG90Long &lt;- read.csv("CityBG1990to2000long.csv", header=T)
    TwpBG90Long &lt;- read.csv("TwpBrainGain1990to2000long.csv", header=T)
    options(RCHART_WIDTH=800, RCHART_HEIGHT=600)
  
  
    function(input, output) {
  
      output$table &lt;- renderDataTable(iris)
  
      set.seed(122)
      histdata &lt;- rnorm(500)
  
      ######################## POPULATION OUTPUTS ########################
      output$PopTable &lt;- renderDataTable({
        data &lt;- CountyPop
        if (input$County != "All"){
          data &lt;- data[data$County %in% input$County,]
        }
        data
      }, options =list(aoColumnDefs = list(list(sClass="alignCenter",aTargets=c(list("_all")) )),  pageLength=10))
  
      output$PopChart &lt;- renderChart({
        names(PopData) = gsub("\\.", "", names(PopData))
        n1 &lt;- nPlot(Population ~ Year, data = PopData, group = "County", type = 'lineChart')
        n1$addParams(dom = 'PopChart')
        n1$yAxis(axisLabel = "Population", width = 62)      
        n1$xAxis(axisLabel = "Year")
        n1$chart(forceY = c(0, 1))
        n1$xAxis(tickValues=c(1900, 1910, 1920, 1930, 1940, 1950, 1960, 1970, 1980, 1990, 2000, 2010))
        return(n1)
      })
  
      output$countyPopDownload &lt;- downloadHandler(
        filename = function() { paste('MNCountyPopData', '.csv', sep='') },
        content = function(file) {
          write.csv(PopData, file)
        }) 
  
      output$CityPopTable &lt;- renderDataTable({
        data &lt;- CityPop
        if (input$County2 != "All"){
          data &lt;- data[data$County %in% input$County2,]
        }
        data
      }, options =list(aoColumnDefs = list(list(sClass="alignCenter",aTargets=c(list("_all")) )),  pageLength=10))
  
      output$CityPopChart &lt;- renderChart({
        var &lt;- reactive({input$County3})
        DF &lt;- subset(CityPopLong, County %in% var())
        names(DF) = gsub("\\.", "", names(DF))
        n2 &lt;- nPlot(Population ~ Year, data = DF, group = "Name", type = 'lineChart')
        n2$addParams(dom = 'CityPopChart')
        n2$yAxis(axisLabel = "Population", width = 62)      
        n2$xAxis(axisLabel = "Year")
        n2$xAxis(tickValues=c(1900, 1910, 1920, 1930, 1940, 1950, 1960, 1970, 1980, 1990, 2000, 2010))
        n2$chart(forceY = c(0, 1))
        return(n2)
      })
  
      output$cityPopDownload &lt;- downloadHandler(
        filename = function() { paste('MNCityPopData', '.csv', sep='') },
        content = function(file) {
          write.csv(CityPop, file)
        }) 
  
      output$TwpPopTable &lt;- renderDataTable({
        data &lt;- TwpPop
        if (input$County4 != "All"){
          data &lt;- data[data$County %in% input$County4,]
        }
        data
      }, options =list(aoColumnDefs = list(list( sClass="alignCenter",aTargets=c(list("_all"))  )),  pageLength=10))
  
  
      renderChart_pct &lt;- function(expr, env = parent.frame(), quoted = FALSE) {
        func &lt;- shiny::exprToFunction(expr, env, quoted)
        function() {
          rChart_ &lt;- func()
          cht_style &lt;- sprintf("&lt;style&gt;.rChart {width: %s; height: %s} &lt;/style&gt;",
                               #### change these here to desired %
                               "100%", "100%")
          cht &lt;- paste(capture.output(rChart_$print()), collapse = '\n')
          HTML(paste(c(cht_style, cht), collapse = '\n'))
        }
      }
  
      output$TwpPopChart &lt;- renderChart({
        var &lt;- reactive({input$County5})
        DF &lt;- subset(TwpPopLong, County %in% var())
        names(DF) = sub("\\.", "", names(DF))
        n2 &lt;- nPlot(Population ~ Year, data = DF, group = "Name", type = 'lineChart')
        n2$addParams(dom = 'TwpPopChart')
        n2$yAxis(axisLabel = "Population", width = 62)      
        n2$xAxis(axisLabel = "Year")
        n2$xAxis(tickValues=c(1900, 1910, 1920, 1930, 1940, 1950, 1960, 1970, 1980, 1990, 2000, 2010))
        n2$chart(forceY = c(0, 1))
        n2$chart(height=500)
        n2$set(width=500)
        return(n2)
      })
  
      output$twpPopDownload &lt;- downloadHandler(
        filename = function() { paste('MNTownshipPopData', '.csv', sep='') },
        content = function(file) {
          write.csv(TwpPop, file)
        })
  
      ######################## POPULATION CHANGE OUTPUTS ########################
  
      output$ChangeTable &lt;- renderDataTable({
        data &lt;- CountyChange
        if (input$County6 != "All"){
          data &lt;- data[data$County %in% input$County6,]
        }
        data
      }, options =list(aoColumnDefs = list(list(sClass="alignCenter",aTargets=c(list("_all"))  )),  pageLength=10))  
  
      output$ChangeChart &lt;- renderChart({
        names(ChangeData) = gsub("\\.", "", names(ChangeData))
        n3 &lt;- nPlot(PercentChange ~ Year, data = ChangeData, group = "County", type = 'lineChart')
        n3$addParams(dom = 'ChangeChart')
        #     n3$yAxis(tickValues=function(d) {return(d + "%")})
        ##    ^infinite recursion
        #     n3$yAxis(tickFormat="#!function(d) {return d3.format('%Y'));}!#" )
        ##    ^all axis values gone, chart turns static
        #     n3$yAxis(labelType='percent')
        ##     ^ only for pie charts
        #     n3$yAxis(tickFormat=function(d) { return(parseInt(d, 10) + "%")})
        ##     ^ "could not find function 'd3.format'"
        n3$yAxis(axisLabel = "Percent Change from Previous Decade", width = 62)      
        n3$xAxis(axisLabel = "Year")
        n3$xAxis(tickValues=c(1900, 1910, 1920, 1930, 1940, 1950, 1960, 1970, 1980, 1990, 2000, 2010))
        return(n3)
      })
  
      output$countyChangeDownload &lt;- downloadHandler(
        filename = function() { paste('MNCountyPopChangeData', '.csv', sep='') },
        content = function(file) {
          write.csv(ChangeData, file)
        }) 
  
      output$cityChangeTable &lt;- renderDataTable({
        data &lt;- CityChange
        if (input$County7 != "All"){
          data &lt;- data[data$County %in% input$County7,]
        }
        data
      }, options =list(aoColumnDefs = list(list(sClass="alignCenter",aTargets=c(list("_all"))  )),  pageLength=10))  
  
      output$cityChangeChart &lt;- renderChart({
        var &lt;- reactive({input$County8})
        DF &lt;- subset(CityChangeLong, County %in% var())
        names(DF) = gsub("\\.", "", names(DF))
        n4 &lt;- nPlot(PercentChange ~ Year, data = DF, group = "Name", type = 'lineChart')
        n4$addParams(dom = 'cityChangeChart')
        n4$yAxis(axisLabel = "Percent Change from Previous Decade", width = 62)      
        n4$xAxis(axisLabel = "Year")
        n4$xAxis(tickValues=c(1900, 1910, 1920, 1930, 1940, 1950, 1960, 1970, 1980, 1990, 2000, 2010))
        #     n3$chart(forceY = c(-100, 100))
        return(n4)
      })
  
      output$cityChangeDownload &lt;- downloadHandler(
        filename = function() { paste('MNCityPopChangeData', '.csv', sep='') },
        content = function(file) {
          write.csv(CityChange, file)
        })
  
      output$twpChangeTable &lt;- renderDataTable({
        data &lt;- TwpChange
        if (input$County9 != "All"){
          data &lt;- data[data$County %in% input$County9,]
        }
        data
      }, options =list(aoColumnDefs = list(list(sClass="alignCenter",aTargets=c(list("_all"))  )), pageLength=10))  
  
      output$twpChangeChart &lt;- renderChart({
        var &lt;- reactive({input$County10})
        DF &lt;- subset(TwpChangeLong, County %in% var())
        names(DF) = gsub("\\.", "", names(DF))
        n5 &lt;- nPlot(PercentChange ~ Year, data = DF, group = "Name", type = 'lineChart')
        n5$addParams(dom = 'twpChangeChart')
        n5$yAxis(axisLabel = "Percent Change from Previous Decade", width = 62)      
        n5$xAxis(axisLabel = "Year")
        n5$xAxis(tickValues=c(1900, 1910, 1920, 1930, 1940, 1950, 1960, 1970, 1980, 1990, 2000, 2010))
        #     n3$chart(forceY = c(-100, 100))
        return(n5)
      })
  
      output$twpChangeDownload &lt;- downloadHandler(
        filename = function() { paste('MNTownshipPopChangeData', '.csv', sep='') },
        content = function(file) {
          write.csv(TwpChange, file)
        })
  
  
      data(movies, package = "ggplot2")
      minx &lt;- min(movies$rating)
      maxx &lt;- max(movies$rating)
  
        output$trendPlot &lt;- renderPlotly({
          # size of the bins depend on the input 'bins'
          size &lt;- (maxx - minx) / input$bins
  
          # a simple histogram of movie ratings
          p &lt;- plot_ly(movies, x = rating, autobinx = F, type = "histogram",
                       xbins = list(start = minx, end = maxx, size = size))
          # style the xaxis
          layout(p, xaxis = list(title = "Ratings", range = c(minx, maxx), autorange = F,
                                 autotick = F, tick0 = minx, dtick = size))
        })
  
  
  
  
    }
  </code></pre>
  
  <p>There is a lot of unused code at the moment because I've not completed the ui. Essentially I'm taking code from a previous shiny code to assemble a shinydashboard.</p>