Axis caption on the Surface graph

Please tell me how to add labels to the axes on the Surface graph.
The result:
image

So, there isnโ€™t any x and y axis title.

And one more question: My graph is based on numeric and text data. But on the graph, instead of text, numbers are written. Is there any way to fix this?
My data is:
image
Now, my code is:

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

fig.update_layout(title='Title',
                  xaxis_title="x Axis Title",
                  yaxis_title="y Axis Title",
                  autosize=False,
                  width=500, height=500,
                  margin=dict(l=65, r=50, b=65, t=90))
fig.show()

@Fleur-de-Grace
In 3d, axes are instances of the classes go.layout.scene.XAxis, go.layout.scene.YAxis, respectivelygo.layout.scene.ZAxis.
Hence, instead of the two lines in your code, that set axis titles , insert:

scene_xaxis_title='xaxis-title',
scene_yaxis_title='yaxis-title`,
1 Like

Yes, indeed, thank you.
And is it possible to display the text on the axis instead of the number?
(for example, i have some names of people and i would like to show them on axis (now just numbers from one to number of names) )
image

@Fleur-de-Grace

Yes, you can associate tickvals, and ticktext, to axes:

fig.update_scenes(xaxis= dict(tickvals=[0, 3.5, 7, 10.5, 14], #text position
                              ticktext=['John', 'Emmy', 'Liza', 'Chris', 'Pete'], #text
                              title='Name'))

and similarly for yaxis.

2 Likes

thank you a lot :relaxed:

1 Like