How to change axis labels in plotly 3d plots?

Viewed 1696
X = np.random.randn(100, 90)
import plotly.graph_objects as go

fig = go.Figure(data=[go.Surface(z=X)])

fig.update_layout(title='something', autosize=False,
                  width=500, height=500,
                  margin=dict(l=65, r=50, b=65, t=90))

fig.show()

Have tried various thing but the axis labels do not change. They just say "x" and "y".

1 Answers

You can change the axis labels inside the scene property.

import numpy as np
import plotly.graph_objects as go

X = np.random.randn(100, 90)
import plotly.graph_objects as go

fig = go.Figure(data=[go.Surface(z=X)])

fig.update_layout(
    title='something', 
    autosize=False,
    width=500, 
    height=500,
    margin=dict(l=65, r=50, b=65, t=90),
    scene=dict(
        xaxis_title='X Axis Title',
        yaxis_title='Y Axis Title',
        zaxis_title='Z Axis Title',
    ),
)

fig.show()

enter image description here

Related