I am trying to map hex from geom_hex to original data points. For example I want to find points in the iris dataframe that are related to highlighted hex (red circle).
data("iris")
rownames(iris) <- paste0("R", 1:nrow(iris))
plt <- ggplot(iris, aes(Sepal.Length, Sepal.Width)) + geom_hex(bins=20, color = "white")
plt
I tried ggplot_build which has 'count' but can't find any information that links to the original data.
g <- ggplot_build(plt)
head(g$data[[1]])