Disabling coordinate lines in plotly

71 Views Asked by At

I am trying to disable the black coordinate lines that appear in plotly.

Scatter3d

I still want the stock tickers to appear as text in hover.

I have already tried turning off hovermode but then my tickers don't appear. Is there any way to specifically turn off the black gridlines that appear when I hover over a point?

1

There are 1 best solutions below

0
Derek O On

Plotly calls these spikes or spike lines, and they are set to appear by default for 3d scatter plots in Plotly. You can disable them with the following line:

fig.update_scenes(xaxis_showspikes=False, yaxis_showspikes=False, zaxis_showspikes=False)

For example:

import plotly.express as px
df = px.data.iris()
fig = px.scatter_3d(df, x='sepal_length', y='sepal_width', z='petal_width',
              color='species')
fig.update_scenes(xaxis_showspikes=False, yaxis_showspikes=False, zaxis_showspikes=False)
fig.show()

enter image description here