You can include the required variables in aes(), then use tooltipto indicate what should be displayed:
p <- ggplot(mtcars, aes(x = disp, y= am, color = as.factor(cyl),
gear=gear, hp=hp))+geom_point()
ggplotly(p,tooltip = c("x", "gear", "hp"))
source
share