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 中有一个水平颜色条


- 使用RSelum从网站(报纸档案)中抓取多个网页 2022-09-06
- 失败的 Canvas 360 jquery 插件 2022-01-01
- Quasar 2+Apollo:错误:找不到ID为默认的Apollo客户端。如果您在组件设置之外,请使用ProvideApolloClient() 2022-01-01
- Fetch API 如何获取响应体? 2022-01-01
- 400或500级别的HTTP响应 2022-01-01
- Css:将嵌套元素定位在父元素边界之外一点 2022-09-07
- CSS媒体查询(最大高度)不起作用,但为什么? 2022-01-01
- Flexslider 箭头未正确显示 2022-01-01
- 如何使用 JSON 格式的 jQuery AJAX 从 .cfm 页面输出查 2022-01-01
- addEventListener 在 IE 11 中不起作用 2022-01-01