How to update x, y and z axes titles for 3D surface plots within a subplot?

I am having trouble changing the axes titles on 3D surface plots within a subplot.

This is how I’m trying to update the titles while iterating through the rows and columns of the subplot:

fig.add_trace(go.Surface(z=z, x=x, y=y,
                                     colorscale='blues',
                                     cauto=False,
                                     cmax=cmax,
                                     cmin=cmin,
                                     reversescale=True,
                                     hovertemplate=hover,
                                     hoverinfo=None),
                                     row=i, col=j)
fig.update_xaxes(title_text="x-axis title test", row=i, col=j)
fig.update_yaxes(title_text="y-axis title test", row=i, col=j)

Here’s what it ends up looking like with the axes titles of x, y and z being unchanged:

I could really use someone’s help here as I’m new to plotly. Thank you!

@meej

Your plots are 3d, and unlike the 2d case, to update xaxis, yaxis, zaxis attributes you have to refer to the scenes:

fig.update_scenes(xaxis_title_text='LooooooooooongX',  
                  yaxis_title_text='LooooooooooongY',  
                  zaxis_title_text='LooooooooooongZ')
1 Like