Obtain observations in geom_hex in a single plot (Shiny)
I am attempting to create an interactive plot of hexbins where a user can click on a given hexbin and receive a list of all observations of the original data frame that were grouped in that clicked hexbin. Below is a MWE that seems pretty close to my goal. I am using Shiny, hexbin(), and ggplotly. app.R library(shiny) library(plotly) library(data.table) library(GGally) library(reshape2) library(hexbin) ui <- fluidPage( plotlyOutput("plot"), verbatimTextOutput("click") ) server <- function(input, output, session) { #Create data set.seed(1) bindata <- data.frame(x=rnorm(100), y=rnorm(100)) h <-