繁体   English   中英

plot.ly子图中的多个X共享轴

[英]Multiple X shared axis in plot.ly subplots

我有两个共享x轴的子图,并且我希望能够同时缩放它们-当我自动缩放第二个图时,我却遇到了问题:x轴只能显示在第一个轴上,或者只能显示在第二个轴上。 如何在两个图表下方显示x轴?

欢呼声,Fih

 var trace1 = { x: [1, 2, 3], y: [2, 3, 4], type: 'scatter' }; var trace3 = { x: [2, 3, 4], y: [600, 700, 800], xaxis: 'x', yaxis: 'y3', type: 'scatter' }; var data = [trace1, trace3]; var layout = { xaxis: { domain: [0, 1], anchor: ('y', 'y3'), }, yaxis: { domain: [0, 0.45], }, yaxis3: { domain: [0.55, 1]}, anchor: 'x', }; Plotly.newPlot('compGraph', data, layout); 

您可以在布局中添加“子图”:

var layout = {
  grid: {
    rows: 2, 
    columns: 1, 
    subplots:[['xy'], ['xy3']], 
    roworder:'bottom to top'},
};

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM