我有如下数据表
X Y Z
12.22 6.38 9.93
8.97 10.37 8.66
8.8 7.6 10.26
10.96 10.18 8.99
8.14 9.77 11.3
17.79 12.99 11.05
11.04 12.93 11.15
11.97 9.79 10.73
10.29 10.2 10.17
9.74 4.58 9.32
10.32 10.47 10.24
9.15 13.59 9.66
8.1 5.85 9.23
6.55 10.58 9.69
18.78 8.29 9.39
然后我创建了一个网格,水平X,垂直Z,在单元格中填充Y值。
选择数据并选择3D曲面图后,它生成了如下图:
我尝试了下面的示例,其中Z中的第一个数字为空:
var data = [
{
z: [[,6.55,8.1,8.14, 8.8,8.97,9.15,9.74,10.29,10.32,10.96,11.04,11.97,12.22,17.79,18.78],
[8.66,0,0,0,0,10.47,0,0,0,0,0,0,0,0,0,0],
[8.99,0,0,0,0,0,0,0,0,0,10.18,0,0,0,0,0],
[9.23,0,5.85,0,0,0,0,0,0,0,0,0,0,0,0,0],
[9.32,0,0,0,0,0,0,4.58,0,0,0,0,0,0,0,0],
[9.39,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8.29],
[9.66,0,0,0,0,0,13.59,0,0,0,0,0,0,0,0,0],
[9.69,10.58,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[9.93,0,0,0,0,0,0,0,0,0,0,0,0,6.38,0,0],
[10.17,0,0,0,0,0,0,0,10.2,0,0,0,0,0,0,0],
[10.24,0,0,0,0,0,0,0,0, 10.47,0,0,0,0,0,0],
[10.26,0,0,0,7.6,0,0,0,0,0,0,0,0,0,0,0],
[10.73,0,0,0,0,0,0,0,0,0,0,0,9.79,0,0,0],
[11.05,0,0,0,0,0,0,0,0,0,0,0,0,0,12.99,0],
[11.15,0,0,0,0,0,0,0,0,0,0,12.93,0,0,0,0],
[11.3,0,0,9.77,0,0,0,0,0,0,0,0,0,0,0,0]],
type: 'surface'
}];
var layout = {
title: 'Mt Bruno Elevation',
autosize: false,
width: 700,
height: 700,
margin: {
l: 130,
r: 100,
b: 130,
t: 180,
}
};
Plotly.newPlot('example', data, layout);
它生成了一个图表,如下所示:
我不知道生成的Z数据是否错误。谁能告诉我我做错了哪一部分?或建议我生成类似于Excel图表的3d曲面的方法