Hovermode using Plotly with R
问题 Is there a way to code the hovermode when using plotly with R and ggplot2? Currently, my code is: plot <- ggplot(data, aes(var1, var2, text=var3)) + geom_point() py$ggplotly(plot) And I want the plotly graph to automatically have the hover mode set to "show closest data on hover" rather than "compare data on hover". 回答1: Add the following argument when calling ggplotly : py$ggplotly(plot, kwargs=list(layout=list(hovermode="closest"))) 回答2: The answer from 'mkcor' didn't work when trying to do