Search code examples
pythonplotly

Remove plotly tick labels


I wanted to make a plotly 3d graph with no tick labels but I failed to find a way to do so

I tried fig.update_layout(xaxis=dict(showticklabels=False)) but the tick labels still appears.

import numpy as np

x = np.linspace(-1,1,100)
y = np.linspace(-1,1,100)
x_mesh, y_mesh = np.meshgrid(x,y)
z = x_mesh**2 + y_mesh**2

fig = go.Figure(data=[go.Surface(x=x,y=y,z=z,colorscale='Sunsetdark_r')])
fig.update_layout(xaxis=dict(showticklabels=False))

fig.show()

Output image

I needed to remove the marked numbers.


Solution

  • Slightly different syntax for 3d charts, try this:

    fig.update_layout(
        scene=dict(
            xaxis=dict(showticklabels=False),
            yaxis=dict(showticklabels=False),
            zaxis=dict(showticklabels=False),
        )
    )