使x轴(线)不可见

时间:2017-10-26 15:00:12

标签: javascript plotly axis

简而言之,我想隐藏作为黑线的x轴部分。

这是我正在处理的代码:

https://codepen.io/rasmusj/pen/WXebOd

javascipt的

var dataFromOliver = [3.2, 5.8, 3.9, 4.1, 1.4];

// standard plot
var trace1 = {
  name: "Grupp 1",
  x: ['Feature A', 'Feature B', 'Feature C', 'Feature D', 'Feature E'],
  y: [3.2, 5.8, 3.9, 4.1, 1.0],

  type: 'bar'
};

// standard plot
var trace2 = {
  name: "Grupp 2",
  x: ['Feature A', 'Feature B', 'Feature C', 'Feature D', 'Feature E'],
  y: [2.2, 5.1, 5.3, 1.1, 1.5],
  type: 'bar'
};

var data = [trace1, trace2];

var layout = {
  title: 'Least Used Feature',
  showlegend: false,
  // xaxis: {
  //       autorange:true,
  //       showgrid:false,
  //       zeroline:false,
  //       showline:false,
  //       autotick:false,
  //       ticks:'',
  //       showticklabels:true,
  //   },
  annotations: [],
   };

initialTextPos = {1:0, 2:-0.2, 3:-0.25, 4:-0.29, 5:-0.32, 6:-0.335};
jumpLength = {1:0, 2:0.4, 3:0.26, 4:0.2, 5:0.16, 6:0.1335}

Plotly.newPlot('myDiv', data, layout);

非常感谢任何帮助。

1 个答案:

答案 0 :(得分:0)

yaxis: {zeroline: false}添加到您的layout

https://plot.ly/javascript/reference/#layout-yaxis-zeroline

enter image description here