Mouse coordinates

Is it possible to get the current x,y coordinates of the mouse anywhere on the graph. Not just when hovering over a plotted data point, but any location on the graph?

I am able to get the horizontal and vertical spikes drawn intersecting on the cursor location, but can’t figure out how to get the actual x,y values at the intersection.

layout = {
‘xaxis’:{
‘showspikes’:True,
‘spikemode’:‘across’,
‘spikesnap’:‘cursor’
},
‘yaxis’:{
‘showspikes’:True,
‘spikemode’:‘across’,
‘spikesnap’:‘cursor’,
},
‘hoverdistance’:0,
‘spikedistance’:-1
}

1 Like