Is it possible to have a horizontal color bar in plotly.js(是否可以在 plotly.js 中有一个水平颜色条)
问题描述
我正在使用 plotly.js 中的等值线图表.有没有办法让颜色条比例在图表底部水平显示,而不是在右侧或左侧垂直显示?
I am working with choropleth charts in plotly.js. Is there a way to get the colorbar scale to display horizontally at the bottom of the chart instead of vertically along the right or left sides?
作为参考,请查看 Plotly 网站上给出的第一个示例 https://plot.ly/javascript/choropleth-maps/#world-choropleth-map-robinson-projection
For reference, check out the first example given at the Plotly site 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 上已经有一个关于它的错误记录
Unfortunately No. There is already a bug logged about it on Github on Apr 15, 2016
https://github.com/plotly/plotly.js/issues/1244
我没有看到任何进展.
这篇关于是否可以在 plotly.js 中有一个水平颜色条的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:是否可以在 plotly.js 中有一个水平颜色条
基础教程推荐
- 检查 HTML5 拖放文件类型 2022-01-01
- 原生拖动事件后如何获取 mouseup 事件? 2022-01-01
- npm start 错误与 create-react-app 2022-01-01
- fetch 是否支持原生多文件上传? 2022-01-01
- Bokeh Div文本对齐 2022-01-01
- Bootstrap 模态出现在背景下 2022-01-01
- 如何添加到目前为止的天数? 2022-01-01
- 即使用户允许,Gmail 也会隐藏外部电子邮件图片 2022-01-01
- Fabric JS绘制具有活动形状的多边形 2022-01-01
- 在 contenteditable 中精确拖放 2022-01-01
