plotly.js中是否可能有水平颜色条 [英] Is it possible to have a horizontal color bar in plotly.js

查看:272
本文介绍了plotly.js中是否可能有水平颜色条的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用plotly.js中的Choropleth图表.有没有一种方法可以使颜色条比例尺在图表底部水平显示,而不是在右侧或左侧垂直显示?

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网站上给出的第一个示例

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中是否可能有水平颜色条的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆