以下代码不起作用。它应该绘制一个“轮廓”图:
<!DOCTYPE html>
<head>
<!-- D3.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.6/d3.min.js"></script>
<!-- jQuery -->
<script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
<!-- Plotly.js -->
<script src="https://d14fo0winaifog.cloudfront.net/plotly-basic.js"></script>
</head>
<body>
<!-- Plotly chart will be drawn inside this DIV -->
<div id="myDiv"></div>
<script>
var size = 100, x = new Array(size), y = new Array(size), z = new Array(size), i, j;
for(i = 0; i < size; i++) {
x[i] = y[i] = -2 * Math.PI + 4 * Math.PI * i / size;
z[i] = new Array(size);
}
for(i = 0; i < size; i++) {
for(j = 0; j < size; j++) {
var r2 = x[i]*x[i] + y[j]*y[j];
z[i][j] = Math.sin(x[i]) * Math.cos(y[j]) * Math.sin(r2) / Math.log(r2+1);
}
}
var data = [ {
z: z,
x: x,
y: y,
type: "contour"
}
];
Plotly.plot("myDiv", data);
</script>
</body>
</html>
我在控制台中有以下警告:
无法识别的跟踪类型“轮廓”
该代码是plotly网站上提供的基本示例。
谢谢你的帮助