How to widen the spacing between the surface plot and its projected planes in Plotly (Python)?

I have created a 3D surface plot with the Plotly (Python) library. But the projected lines on the x- and z-projection planes are very hard to see because they are too closed to the surface plot. Any idea on how to widen the spacing between the surface plot and its x- and z-projection planes?

import pandas as pd
import plotly.graph_objects as go


src = 'https://raw.githubusercontent.com/plotly/datasets/master/api_docs/mt_bruno_elevation.csv'
z = pd.read_csv(src).values

fig = go.Figure(
    data=[
        go.Surface(
            z=z,
            contours=dict(
                x=dict(show=True, highlightcolor='limegreen', project_x=True),
                z=dict(show=True, highlightcolor='limegreen', project_z=True)
            )
        )
    ]
)
fig.update_layout(
    width=800, 
    height=800,
)
fig.show()

enter image description here


Solution 1:

You can try manually setting the lower end of the range for the y-axis and z-axis. This will increase the spacing between the projection and the surface when Plotly renders the surface plot.

import pandas as pd
import plotly.graph_objects as go


src = 'https://raw.githubusercontent.com/plotly/datasets/master/api_docs/mt_bruno_elevation.csv'
z = pd.read_csv(src).values

fig = go.Figure(
    data=[
        go.Surface(
            z=z,
            contours=dict(
                x=dict(show=True, highlightcolor='limegreen', project_x=True),
                z=dict(show=True, highlightcolor='limegreen', project_z=True)
            )
        )
    ]
)


fig.update_layout(
    scene = dict(
        xaxis = dict(range=[-5,25]),
        zaxis = dict(range=[-50,500],),),
    width=800,
    height=800
)

fig.show()

enter image description here