我是Plotly的新手,正在通过创建虚拟线图进行练习。但我遇到了一个问题,无法移除x轴的showline。我已将其设置为false,使用zeroline,并尝试使用linecolor使其透明,但它仍然存在。巧合的是,y轴正常工作,并且两个轴的showgrid也可以正常显示。
我猜测问题可能源于使用“类别”类型来显示季节“2017-18”,“2018-19”等,但希望有经验的Plotly用户能够确认(或提供解决方法)。谢谢。
var bedford = {
x: ['2009-10', '2010-11', '2011-12', '2012-13', '2013-14', '2014-15', '2015-16', '2016-17', '2017-18', '2018-19'],
y: [2812, 2654, 2828, 3051, 2261, 2496, 2611, 2515, 2530, 2527],
name: 'Bedford',
mode: 'lines+markers',
line: {
color: 'rgb(128,191,255)',
width: 2
}
};
var birmingham = {
x: ['2009-10', '2010-11', '2011-12', '2012-13', '2013-14', '2014-15', '2015-16', '2016-17', '2017-18', '2018-19'],
y: [975, 894, 881, 971, 947, 1098, 1046, 830, 800, 676],
name: 'Birmingham',
mode: 'lines+markers',
line: {
color: 'rgb(230,0,0)',
width: 2
}
};
var data = [bedford, birmingham];
var layout = {
title: 'Second Tier Clubs Average Attendances',
xaxis: {
title: 'Season',
type: 'category',
showline: false,
linewidth: 0
},
yaxis: {
title: 'Attendance',
range: [0, 3500],
showline: false,
linewidth: 0
}
};
Plotly.newPlot('attendanceDiv', data, layout);