gpt4 book ai didi

javascript - 无法识别的跟踪类型 "contour"plotly javascript

转载 作者:行者123 更新时间:2023-12-03 09:19:34 28 4
gpt4 key购买 nike

以下代码不起作用。它应该绘制一个“轮廓”图:

<!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网站上提供的基本示例。

感谢您的帮助

最佳答案

根据文档 plotly-basic.js 适用于基本图表。等高线图是高级图表 - 请参阅https://plot.ly/javascript-graphing-library/#advanced-charts

关于javascript - 无法识别的跟踪类型 "contour"plotly javascript,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31877168/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com