在执行下面给出的代码时,所有z坐标都正确显示,但x轴仅显示1-10个坐标,y轴仅显示s1,s2,s3,s4坐标。如何绘制此3D曲面图中的所有坐标?
list.c:18:7: error: non-ASCII characters are not allowed outside of literals and
identifiers
scanf(“%d”,&newnode->x);
^
list.c:18:10: error: expected expression
scanf(“%d”,&newnode->x);
^
list.c:18:12: error: non-ASCII characters are not allowed outside of literals
and identifiers
scanf(“%d”,&newnode->x);
^
list.c:18:11: error: use of undeclared identifier 'd'
scanf(“%d”,&newnode->x);
^
4 errors generated.

var data = [{
z: [
[1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5, 10],
[2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5, 10.5, 11],
[3.5, 4.5, 6.5, 7.5, 8.5, 9.5, 4.5, 3.5, 2.5, 10],
[5.5, 6.5, 7.5, 15.5, 16.5, 17.5, 18.5, 19.5, 12.5, 17]
],
x: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
y: ['s1', 's2', 's3', 's4', 's5', 's6', 's7', 's8', 's9', 's10'],
type: 'surface'
}];
var layout = {
title: 'Trips Overview',
scene: {
xaxis: {
title: 'Time',
titlefont: {
color: 'red',
family: 'Arial, Open Sans',
size: 12
}
},
yaxis: {
title: 'stops',
titlefont: {
color: 'red',
family: 'Arial, Open Sans',
size: 12
}
},
zaxis: {
title: 'trips',
titlefont: {
color: 'red',
family: 'Arial, Open Sans',
size: 12
}
}
},
autosize: true
};
Plotly.newPlot('myDiv', data, layout);

答案 0 :(得分:0)
我在codepen中检查了曲面表面绘图,因此对于数组中的每个X轴和Y轴值,z数组中应该有一个相应的子数组。
{{1}}
因此,您只为Z数组提供了4个列表,因此我们无法在上面看到“s5”。
参考: