Plotly.js 3D散点图showgrid:false不起作用

时间:2016-07-20 19:26:09

标签: plotly

http://codepen.io/rudi8292/pen/QEmKPG

上面的代码不允许我在3DScatter图中隐藏网格线。

我试图使用以下选项隐藏x,y,z网格线:

  var layout = {
    title: 'Plotly Graph',
    xaxis: {
        autorange: true,
        showgrid: false,
        zeroline: false,
        showline: false,
        autotick: true,
        ticks: '',
        showticklabels: false
    },
    yaxis: {
        autorange: true,
        showgrid: false,
        zeroline: false,
        showline: false,
        autotick: true,
        ticks: '',
        showticklabels: false
    },
    zaxis: {
        autorange: true,
        showgrid: false,
        zeroline: false,
        showline: false,
        autotick: true,
        ticks: '',
        showticklabels: false
    },
    margin: {
        l: 0,
        r: 0,
        b: 0,
        t: 0
    },

    showlegend: true,
    legend: {
        "x": "0",
        "margin.r": "120"
    }
};
Plotly.newPlot('plotly-div', data, layout, {

    displaylogo: false
});

这就是我的目标:

http://codepen.io/plotly/pen/KpLVzv

提前致谢!

1 个答案:

答案 0 :(得分:0)

需要使用场景字段来操作xaxis,yaxis和zaxis自定义值。

  var layout = {
    scene : {
        xaxis: {
        autorange: true,
        showgrid: false,
        zeroline: false,
        showline: false,
        autotick: true,
        ticks: '',
        showticklabels: false
    },
    yaxis: {
        autorange: true,
        showgrid: false,
        zeroline: false,
        showline: false,
        autotick: true,
        ticks: '',
        showticklabels: false
    },
    zaxis: {
        autorange: true,
        showgrid: false,
        zeroline: false,
        showline: false,
        autotick: true,
        ticks: '',
        showticklabels: false
    },
    margin: {
        l: 0,
        r: 0,
        b: 0,
        t: 0
    },
    showlegend: true,
    legend: {
        "x": "0",
        "margin.r": "120"
    }
};
Plotly.newPlot('plotly-div', data, layout, {

    displaylogo: false
});

http://codepen.io/rudi8292/pen/XKENgx

非常感谢ÉtienneTétreault-Pinard