给出一组这样的数据:
z: [[10, 10.625, 12.5, 15.625, 20],
[5.625, 6.25, 8.125, 11.25, 15.625],
[2.5, 3.125, 5., 8.125, 12.5],
[0.625, 1.25, 3.125, 6.25, 10.625],
[0, 0.625, 2.5, 5.625, 10]]
有没有办法修正z的值并跟踪等值线并获得等值线图中的值x,y。例如,我有两行,其中z = 4,z = 6,我希望得到x,y的值,并在z = 5.5时跟踪等值线对应物。
您可以在下面找到代码示例。
var data = [ {
z: [[10, 10.625, 12.5, 15.625, 20],
[5.625, 6.25, 8.125, 11.25, 15.625],
[2.5, 3.125, 5., 8.125, 12.5],
[0.625, 1.25, 3.125, 6.25, 10.625],
[0, 0.625, 2.5, 5.625, 10]],
type: 'contour',
colorscale: 'Jet',
contours:{
coloring: 'lines',
showlabels: true
}
}];
var layout = {
title: 'Contour Lines'
};
Plotly.newPlot('myDiv', data, layout);
<head>
<!-- Plotly.js -->
<script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
</head>
<body>
<div id="myDiv"><!-- Plotly chart will be drawn inside this DIV --></div>
</body>
答案 0 :(得分:0)
我找到了一种方法来修正曲线轮廓图中z的值。这是我的代码:
var data = [ {
z: [[10, 10.625, 12.5, 15.625, 20],
[5.625, 6.25, 8.125, 11.25, 15.625],
[2.5, 3.125, 5., 8.125, 12.5],
[0.625, 1.25, 3.125, 6.25, 10.625],
[0, 0.625, 2.5, 5.625, 10]],
type: 'contour',
colorscale: 'Jet',
autocontour: true,
ncontours: 1,
zmin: 5,
zmax: 5.1,
type: 'contour',
showscale: false,
contours: {
coloring: 'lines',
showlabels: true}
}];
var layout = {
title: 'Contour Lines'
};
Plotly.newPlot('myDiv', data, layout);
&#13;
<head>
<!-- Plotly.js -->
<script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
</head>
<body>
<div id="myDiv"><!-- Plotly chart will be drawn inside this DIV --></div>
</body>
&#13;
如果使用plotly键,则测试reference documentation
中存储的所有属性组合