title: Select values in two columns based on two inputs respectively in Shiny, with plotly
body: <p>I have been working on a filtering graph in shiny and want to incorporate Plotly graphs. However, whenever I attempt to plot with Plotly I get a blank graph. Below is my attempt (without Plotly)
  how I tried to integrate Plotly.</p>
  <p>Working ( not Plotly)</p>
  <pre><code>library(shinydashboard)
  library(tidyverse)
  library(plotly)
  library(shiny)
  
  #______________________________________________________________________________#
  server &lt;- function(input, output, session) { 
      df &lt;- reactive({
          subset(iris, Petal.Width == input$Petalw)
      })
      
      # Extract list of Petal Lengths from selected data - to be used as a filter
      p.lengths &lt;- reactive({
          unique(df()$Petal.Length)
      })
      
      # Filter based on Petal Length
      output$PetalL &lt;- renderUI({
          selectInput(&quot;PetalLengthSelector&quot;, &quot;PetalLength&quot;, as.list(p.lengths()))
      })
      
      # Subset this data based on the values selected by user
      df_1 &lt;- reactive({
          foo &lt;- subset(df(), Petal.Length == input$PetalLengthSelector)
          return(foo)
      })
      
      output$table &lt;- DT::renderDataTable(
          DT::datatable(df_1(), options = list(searching = FALSE,pageLength = 25))
      )
      
      output$correlation_plot &lt;- renderPlot({
          plot(df_1()$Petal.Length, df_1()$Petal.Width,
               xlab = &quot;Length&quot;, ylab = &quot;Width&quot;)
      })
  }
  
  #______________________________________________________________________________#
  ui &lt;- navbarPage(
      title = 'Select values in two columns based on two inputs respectively',
      
      fluidRow(
          column(width = 12,
                 plotOutput('correlation_plot')
          )
      ),
      
      
      fluidRow(
          column(width = 3,
                 selectInput(&quot;Petalw&quot;,&quot;PetalWidth&quot;, choices = unique(iris$Petal.Width),multiple = T),
                 uiOutput(&quot;PetalL&quot;)
          ),
          column(9,
                 tabPanel('Table', DT::dataTableOutput('table'))
          )
      )
  )
  shinyApp(ui, server)
  </code></pre>
  <p>How I've modified to try and use Plotly...</p>
  <pre><code> output$correlation_plot &lt;- renderPlotly({
          plot1 &lt;- plot_ly(data=df_1(),
                           x = ~Petal.Length,
                           y = ~Petal.Width,
                           type = 'scatter',
                           mode = 'markers'
                           )
  </code></pre>