# add interactive hexagonal heatmaps to a ggplot -------
library(ggplot2)
library(ggiraph)
p <- ggplot(diamonds, aes(carat, price)) +
geom_hex_interactive(aes(tooltip = after_stat(count)), bins = 10)
x <- girafe(ggobj = p)
if( interactive() ) print(x)
Run the code above in your browser using DataLab