代码之家  ›  专栏  ›  技术社区  ›  RasmusJ

使x轴(线)不可见

  •  0
  • RasmusJ  · 技术社区  · 7 年前

    简而言之,我想隐藏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 回复  |  直到 7 年前
        1
  •  0
  •   Maximilian Peters    7 年前

    yaxis: {zeroline: false} 给你的 layout .

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

    enter image description here