Setting standoff of axis label in 3d plot in plotly (ticks labels overlap with axis label)

Viewed 419

In case of 2d charts in plotly we can set standoff of axis label by setting standoff property (example: https://community.plotly.com/t/adding-space-beetween-axis-title-and-values/32218), but in case of 3d plots there is no property standoff because axis have to specified as dictionary values of scene, the problem is custom ticks labels overlap with axis label:

import plotly.graph_objects as go
import numpy as np

ticktext = ["tick labels X"] * 3

layout = go.Layout(
         scene = dict(
                    xaxis = dict(
                        title=dict(text='xaxis'
                                   #, standoff=20 # don't work
                                  ),
                        tickvals=list(range(len(ticktext))),
                        ticktext=ticktext,
                    ),
                    yaxis = dict(
                        title='yaxis',
                        tickvals=list(range(len(ticktext))),
                        ticktext=ticktext,
                    ),
                    zaxis = dict(
                        title='zaxis',
                    )
         ),
)

# chart
data = np.array([[1,2,3],[3,1,2],[3,1,2]])

plotly_input_data = []
plotly_input_data.append(go.Surface(z = data + 1, showscale=False, opacity=0.9))
plotly_input_data.append(go.Surface(z = data**2-6, showscale=False, opacity=1.0))

fig = go.Figure(data=plotly_input_data, layout = layout)
fig.show()

enter image description here

This is '4.13.0' version of plotly.

Edition

Also using fig.layout.xaxis.title.standoff = 20 does not work.

0 Answers
Related