我正在使用plotly.js中的choropleth图表。有没有办法让色条比例在图表底部水平显示,而不是沿右侧或左侧垂直显示?
作为参考,请查看Plotly网站https://plot.ly/javascript/choropleth-maps/#world-choropleth-map-robinson-projection
上给出的第一个示例谢谢!
Plotly.d3.csv('https://raw.githubusercontent.com/plotly/datasets/master/2010_alcohol_consumption_by_country.csv', function(err, rows){
function unpack(rows, key) {
return rows.map(function(row) { return row[key]; });
}
var data = [{
type: 'choropleth',
locationmode: 'country names',
locations: unpack(rows, 'location'),
z: unpack(rows, 'alcohol'),
text: unpack(rows, 'location'),
autocolorscale: true
}];
var layout = {
title: 'Pure alcohol consumption among adults (age 15+) in 2010',
geo: {
projection: {
type: 'robinson'
}
}
};
Plotly.plot(myDiv, data, layout, {showLink: false});
});
答案 0 :(得分:1)