# NOT RUN {
# add interactive contours to a ggplot -------
library(ggplot2)
library(ggiraph)
v <- ggplot(faithfuld, aes(waiting, eruptions, z = density))
p <- v + geom_contour_interactive(aes(
colour = stat(level),
tooltip = paste("Level:", stat(level))
))
x <- girafe(ggobj = p)
if (interactive()) print(x)
# }
Run the code above in your browser using DataCamp Workspace