Get figure to Stick to Axes data as given by X and Y

Using this code

   fig_data = [go.Surface(x=X, y=Y, z=Z)]
   fig = go.Figure(data=fig_data)
   fig.update_traces(contours_z=dict(show=True, usecolormap=True,highlightcolor="limegreen",project_z=True))
   fig.update_layout(scene = dict(
                        yaxis_title = param1_name,
                        xaxis_title = param2_name,
                        zaxis_title = metric_name),
                        width=700,
                        margin=dict(r=20, b=10, l=10, t=10))

in which:

X is a 1x2 array
Y is a 1x10 array
Z is a 10x2 array

I get the surface drawn correctly, but the X axis doesn’t strictly follow the values in the array; instead, additional ticks (if this is the right term here) are added between the values.

For example, if X = [2,3], the X-axis values I get are 2.0, 2.2 ,2.4 ,2.6 ,2.8 .3.0 - naturally there are no data points that correspond to the values between 2 and 3 - they are redundant and add unnecessary confusion while viewing the plot.

How to get the figure to just stick to the axis values given and not add additional ones between them?

Hi @Walrus ,

this may be of help, if I understand your question correctly.

Thanks, I managed to solve it with:

    fig.update_layout(scene = dict(
                        yaxis_title = param1_name,
                        xaxis_title = param2_name,
                        zaxis_title = metric_name,
                        xaxis = dict(tickmode="array",tickvals=X),
                        yaxis = dict(tickmode="array",tickvals=Y)),
                        width=700,
                        margin=dict(r=20, b=10, l=10, t=10))