Plotly.js:如何避免重叠轮廓线?

时间:2016-05-27 11:09:21

标签: javascript d3.js contour plotly

下面是使用plotly.js创建等高线图的示例。一些轮廓线重叠

如何更改绘图设置以避免这种情况(例如,增加分辨率,切换轮廓算法)?如果我使用conrec.js绘制相同的数据,轮廓不会重叠。

:一种。 Conrec.js (这有效,没有重叠)

enter image description here

示例的源代码: https://github.com/jasondavies/conrec.js/tree/master/example

B中。 Plotly.js (不起作用:重叠轮廓)

enter image description here

示例的源代码: https://jsfiddle.net/jwmdw3o1/

资源:

https://cdn.plot.ly/plotly-latest.min.js

https://github.com/mbostock/d3/raw/v1.10.1/d3.js

HTML:

<script>
 $(document).ready(function(){
    setInterval(function(){ reload_page(); },60*60000);
 });

 function reload_page()
 {
    window.location.reload(true);
 }
</script>

JavaScript的:

<div id="graph"></div>

1 个答案:

答案 0 :(得分:1)

使用&#34;平滑来调整行选项:0&#34;解决了这个问题:

var data = [ {
 ...
  line: {   
    smoothing: 0    
  }
  ...
}];

https://plot.ly/javascript/reference/#contour-line