Can we make these values seen only when hovered . Example "Toyota Corolla" to be seen only when hovered. Now all the values are appearing
library(plotly)
data <- mtcars[which(mtcars$am == 1 & mtcars$gear == 4),]
fig <- plot_ly(data, x = ~wt, y = ~mpg, type = 'scatter', mode = 'markers',
marker = list(size = 10))
fig <- fig %>% add_annotations(x = data$wt,
y = data$mpg,
text = rownames(data),
xref = "x",
yref = "y",
showarrow = TRUE,
arrowhead = 4,
arrowsize = .5,
ax = 20,
ay = -40,
# Styling annotations' text:
font = list(color = '#264E86',
family = 'sans serif',
size = 14))
fig