Extracting a polygon from geom_hex



Dear All,

I want to extract the hexagon with the highest count. I am able to extract the co ordinates of the centre of the hexagon which has the highest count as follows :

mydata <- data.frame(x=rnorm(n), y=rnorm(n))
gg <- ggplot(mydata, aes(x, y)) + geom_hex()
toanalyze <- ggplot_build(gg)
#Select the maximum
order(toanalyze$data[[1]]$count,decreasing = TRUE)[1]

   fill         x         y density count PANEL group colour size alpha
65 #56B1F7 0.7975297 0.7783473    0.03     3     1    -1     NA  0.5    NA

My query is : How can I compute the vertices of this hexagon ? Also how can I divide this hexagon with further smaller hexagons ?

Many thanks,