title: How to create a pop-up upon selection of points in a plot in a Shiny App
body: <p>I have the following Shiny Application:</p>
  
  <pre><code>library(ggplot2)
  library(Cairo)   # For nicer ggplot2 output when deployed on Linux
  
  mtcars2 &lt;- mtcars[, c("mpg", "cyl", "disp", "hp", "wt", "am", "gear")]
  
  
  ui &lt;- fluidPage(
    fluidRow(
      column(width = 4,
             plotOutput("plot1", height = 300,
                        # Equivalent to: click = clickOpts(id = "plot_click")
                        click = "plot1_click",
                        brush = brushOpts(
                          id = "plot1_brush"
                        )
             )
      )
    ),
    fluidRow(
      column(width = 6
      ),
      column(width = 6,
             actionButton("show", "Show points"),
             verbatimTextOutput("brush_info")
      )
    )
  )
  
  server &lt;- function(input, output) {
    output$plot1 &lt;- renderPlot({
      ggplot(mtcars2, aes(wt, mpg)) + geom_point()
    })
  
    observeEvent(input$show, {
      showModal(modalDialog(
        title = "Important message",
        "This is an important message!",
        easyClose = TRUE
      ))
    })
  
    output$click_info &lt;- renderPrint({
      # Because it's a ggplot2, we don't need to supply xvar or yvar; if this
      # were a base graphics plot, we'd need those.
      nearPoints(mtcars2, input$plot1_click, addDist = TRUE)
    })
  
    output$brush_info &lt;- renderPrint({
      brushedPoints(mtcars2, input$plot1_brush)
    })
  }
  
  shinyApp(ui, server)
  </code></pre>
  
  <p>Right now this table shows me the points I have selected on the graph. This works, however I would like to automatically create a popup with that data as soon you have selected something. So the functionality I have right now with the button "Show points" but then with the input of the <code>brushedPoints(mtcars2, input$plot1_brush)</code></p>
  
  <p>Any thoughts on how I get this working?</p>