library(ggplot2)
library(ggiraph)
dataset <- mtcars
dataset$carname <- row.names(mtcars)
gg <- ggplot(
data = dataset,
mapping = aes(
x = wt, y = qsec, color = disp,
tooltip = carname, data_id = carname
)
) +
geom_point_interactive()
girafe(ggobj = gg)4 Interactivity with ggiraph
The package ggiraph (Gohel and Skintzos (2025)) makes ggplot graphics interactive.
Example from here.
Hovering over the point shows the names of the cars.
Don’t forget to call the girafe function otherwise it will be a plain ggplot image and not an interactive plot.