By default, when hovering over a data point plotly prints its y-value near the cursor and its x-value on the x-axis. The default behavior corresponds to
Layout. This can be
really annoying if you have several points sharing the same x-value !In contrast, with
hovermode:y, Plotly prints x-values near the cursor and y-values on the y-axis. Alternatively, when
hovermodeis set to
closest, information about the data point closest to where the viewer is hovering appears next to the cursor.
# Make data
b=sample( c(1:10) , 100 , replace=T)
# Plotly library
# Make the graph
my_graph=plot_ly(x=b , y=a , mode="markers" , size=abs(a)/2 , color=ifelse(a>0,"blue","red") ) %>%
#Change hover mode in the layout argument :
layout( hovermode="closest" )
# show the graph
Not what you are looking for ? Make a new search !