在 plotly.js 中是否可以有水平色条
Is it possible to have a horizontal color bar in plotly.js
我正在 plotly.js 中使用等值线图。有没有办法让颜色条标尺水平显示在图表底部,而不是垂直显示在右侧或左侧?
作为参考,请查看 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});
});
不幸的是没有。2016 年 4 月 15 日 Github 上已经记录了一个关于它的错误
https://github.com/plotly/plotly.js/issues/1244
我没有看到任何进展。
我正在 plotly.js 中使用等值线图。有没有办法让颜色条标尺水平显示在图表底部,而不是垂直显示在右侧或左侧?
作为参考,请查看 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});
});
不幸的是没有。2016 年 4 月 15 日 Github 上已经记录了一个关于它的错误
https://github.com/plotly/plotly.js/issues/1244
我没有看到任何进展。