Reputation: 13
So I'm using Plotly.js to plot a 3D scatter plot and I'm trying to change the labels of each axes. On the Plotly page says that I have to do this (The dims list contains the axes' names.):
var layout = {
margin: {
l: 0,
r: 0,
b: 0,
t: 0
},
xaxis : {
title : {
text : dims[0]
}
},
yaxis : {
title : {
text : dims[1]
}
},
zaxis : {
title : {
text : dims[2],
}
}};
But by doing so I still get the axes' names to be x,y and z.
If I go on the console and type
$0.layout.zaxis.title
I get the right title for the Z axis but on the plot it self it shows this:
Please help :)
Upvotes: 0
Views: 823
Reputation: 356
I stumbled accross this as well. What you need to do is to add desired titles in scene object, like this:
var layout = {
margin: {
l: 0,
r: 0,
b: 0,
t: 0,
},
scene: {
xaxis: { title: "X AXIS TITLE" },
yaxis: { title: "Y AXIS TITLE" },
zaxis: { title: "Z AXIS TITLE" },
},
};
Upvotes: 5