Reputation: 297
I am using Plotly to chart a Sine wave (see code below). I would like to increase the distance between the cursor and its information box. Any help regarding how to change the distance is appreciated.
import plotly.graph_objs as go
import numpy as np
# Generate data for sine wave
x = np.linspace(0, 2*np.pi, 100)
y = np.sin(x)
# Create figure
fig = go.Figure(data=[go.Scatter(x=x, y=y)])
# Display the x and y values when moving the cursor.
fig.update_layout(hovermode = 'x unified')
#Show figure
fig.show()
Upvotes: 0
Views: 682
Reputation: 65
hoverdistance sets the distance to look for data to use for the hover label, rather than the distance of the hover label from the datapoint. So, you could remove that line as I don't think that's what you're trying to do.
There's no option to set the distance between the point and the hoverlabel as far as I'm aware, this is a reported issue here: Reported issue
One option may be to set the bgcolor to something that's transparent:
`fig.update_layout(hovermode = 'x unified', hoverlabel=dict(bgcolor='rgba(255,255,255,0.1)'))`
At least that way you can still see the plot behind, if that's what your concern is about.
Upvotes: 1