Plotly.js axis properties are not applied

Hi,

I am trying to plot a 3D surface plot using the below code. I need to change the axis properties as in the code below. But the result does not adhere to the axis properties I provide in the layout variable. Please help me to fix this issue. Thanks.

var data = [{

        y: [1,2,3,4],
        x: [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25],
    z: Z,
    type: 'surface'

}];

var layout = {
xaxis: {
title: ‘Electrode Column index’,
autorange: false,
tickmode: ‘array’,
tickvals: [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25],
ticks: ‘outside’,
tick0: 1,
dtick: 1,
ticklen: 25,
tickwidth: 1,
tickcolor: ‘#000
},
yaxis: {
title: ‘Electrode Row Index’,
autorange: false,
tickmode: ‘array’,
tickvals: [1, 2, 3, 4],
ticks: ‘outside’,
tick0: 4,
nticks: 4,
dtick: 1,
gridwidth: 1,
tickcolor: ‘#000
},
zaxis: {
title: ‘Current Density’,
autorange: true
},
title: ‘Current Density’,
autosize: false,
width: 500,
height: 500,
margin: {
l: 1,
r: 1,
b: 10,
t: 50,
}
};
Plotly.newPlot(‘myDiv’, data, layout);

3D axis properties need to be wrapped inside a scene object. See https://plot.ly/javascript/3d-axes/

1 Like

Thanks for the reply. It solved the issue.