title: ggplot2 output in shiny app
body: <p>I am struggling to find a way to connect the input variable that I have named "plot1" to the actual reactive variable I have made.  I know how to do this with ggvis (bind_shiny function), but I am working with ggplot for the first time and do not know how to do this.  I know the code contained within the reactive variable vis works as a standalone without the reactive component.  Any help is much appreciated!  Sample code is below.</p>
  
  <pre><code>#Check packages to use in library
  {
    library('shiny') #allows for the shiny app to be used
    library('ggplot2')
    library('dplyr')
    library('stringr') #string opperator
    library('dplyr')
    library('RSQLite')
  }
  
  #Data
  
  horizontal_position &lt;- c(-2, -1, 0, 1, 2)
  vertical_position &lt;- c(-2, -2, -2, -2, -2, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2)
  
  ID_no &lt;- 1
  data_val &lt;- sample(0:100, 25)
  ID_1 &lt;-data.frame(ID_no, horizontal_position, vertical_position, data_val)
  
  ID_no &lt;- 2
  data_val &lt;- sample(0:100, 25)
  ID_2 &lt;-data.frame(ID_no, horizontal_position, vertical_position, data_val)
  
  all_data &lt;-rbind(ID_1, ID_2)
  IDchoices &lt;- as.character(unique(all_data$ID_no))
  
  # UI
  
  ui &lt;- fluidPage(
    fluidRow(
     column(2,
             wellPanel(
              selectInput(inputId = "ID", label="Select ID:", choices = IDchoices, selected = "1", multiple = FALSE, selectize = TRUE)
            )
             )
      ),
      column(9,
             wellPanel(plotOutput("plot1")
            ))
   )
  
  #SERVER
  
  server &lt;- function(input, output, session)
  {
   filteredData &lt;- reactive({
     m &lt;- all_data %&gt;% filter(
       ID_no %in% input$ID
      )
     m
   })
   vis &lt;- reactive({          
        p1 = filteredData() %&gt;%
        ggplot(aes(horizontal_position, vertical_position)) +
        geom_tile(aes(fill = data_val)) + 
        geom_text(aes(label = data_val),colour="white")
    })
  }
  
  #Run the Shiny App to Display Webpage
  
  shinyApp(ui=ui, server=server)
  </code></pre>