plot.ly 可以使用 javascript(不是 python)api 绘制多个曲面吗?
can plot.ly graph multiple surfaces using the javascript (not python) api?
任何人都知道是否有办法制作多面图表(如果有,怎么做),例如 https://plot.ly/python/3d-surface-plots/ 处显示的底部图表,但使用 javascript plot.ly api 而不是 python 那个?
要重现您在 plotly cloud 上看到的任何 plotly 图表,请将 .js
附加到图表的 URL:
这个代码笔:
http://codepen.io/plotly/pen/GogNjj
应该会有帮助。
HTML代码:
<html>
<head>
<script src="http://cdn.plot.ly/plotly-latest.min.js"></script>
</head>
<body>
<!-- Plotly chart will be drawn inside this DIV -->
<div id="example"></div>
<script>
z1 = [
[8.83,8.89,8.81,8.87,8.9,8.87],
[8.89,8.94,8.85,8.94,8.96,8.92],
[8.84,8.9,8.82,8.92,8.93,8.91],
[8.79,8.85,8.79,8.9,8.94,8.92],
[8.79,8.88,8.81,8.9,8.95,8.92],
[8.8,8.82,8.78,8.91,8.94,8.92],
[8.75,8.78,8.77,8.91,8.95,8.92],
[8.8,8.8,8.77,8.91,8.95,8.94],
[8.74,8.81,8.76,8.93,8.98,8.99],
[8.89,8.99,8.92,9.1,9.13,9.11],
[8.97,8.97,8.91,9.09,9.11,9.11],
[9.04,9.08,9.05,9.25,9.28,9.27],
[9,9.01,9,9.2,9.23,9.2],
[8.99,8.99,8.98,9.18,9.2,9.19],
[8.93,8.97,8.97,9.18,9.2,9.18]
];
z2 = [];
for (var i=0;i<z1.length;i++ ) {
z2_row = [];
for(var j=0;j<z1[i].length;j++) {
z2_row.push(z1[i][j]+1);
}
z2.push(z2_row);
}
z3 = []
for (var i=0;i<z1.length;i++ ) {
z3_row = [];
for(var j=0;j<z1[i].length;j++) {
z3_row.push(z1[i][j]-1);
}
z3.push(z3_row);
}
var data_z1 = {z: z1, type: 'surface'};
var data_z2 = {z: z2, showscale: false, opacity:0.9, type: 'surface'};
var data_z3 = {z: z3, showscale: false, opacity:0.9, type: 'surface'};
Plotly.newPlot('example', [data_z1, data_z2, data_z3]);
</script>
</body>
</html>
任何人都知道是否有办法制作多面图表(如果有,怎么做),例如 https://plot.ly/python/3d-surface-plots/ 处显示的底部图表,但使用 javascript plot.ly api 而不是 python 那个?
要重现您在 plotly cloud 上看到的任何 plotly 图表,请将 .js
附加到图表的 URL:
这个代码笔:
http://codepen.io/plotly/pen/GogNjj
应该会有帮助。
HTML代码:
<html>
<head>
<script src="http://cdn.plot.ly/plotly-latest.min.js"></script>
</head>
<body>
<!-- Plotly chart will be drawn inside this DIV -->
<div id="example"></div>
<script>
z1 = [
[8.83,8.89,8.81,8.87,8.9,8.87],
[8.89,8.94,8.85,8.94,8.96,8.92],
[8.84,8.9,8.82,8.92,8.93,8.91],
[8.79,8.85,8.79,8.9,8.94,8.92],
[8.79,8.88,8.81,8.9,8.95,8.92],
[8.8,8.82,8.78,8.91,8.94,8.92],
[8.75,8.78,8.77,8.91,8.95,8.92],
[8.8,8.8,8.77,8.91,8.95,8.94],
[8.74,8.81,8.76,8.93,8.98,8.99],
[8.89,8.99,8.92,9.1,9.13,9.11],
[8.97,8.97,8.91,9.09,9.11,9.11],
[9.04,9.08,9.05,9.25,9.28,9.27],
[9,9.01,9,9.2,9.23,9.2],
[8.99,8.99,8.98,9.18,9.2,9.19],
[8.93,8.97,8.97,9.18,9.2,9.18]
];
z2 = [];
for (var i=0;i<z1.length;i++ ) {
z2_row = [];
for(var j=0;j<z1[i].length;j++) {
z2_row.push(z1[i][j]+1);
}
z2.push(z2_row);
}
z3 = []
for (var i=0;i<z1.length;i++ ) {
z3_row = [];
for(var j=0;j<z1[i].length;j++) {
z3_row.push(z1[i][j]-1);
}
z3.push(z3_row);
}
var data_z1 = {z: z1, type: 'surface'};
var data_z2 = {z: z2, showscale: false, opacity:0.9, type: 'surface'};
var data_z3 = {z: z3, showscale: false, opacity:0.9, type: 'surface'};
Plotly.newPlot('example', [data_z1, data_z2, data_z3]);
</script>
</body>
</html>