【问题标题】:How to change the colors of rings on a sunburst Plotly chart如何更改旭日形图上环的颜色
【发布时间】:2020-10-07 17:10:29
【问题描述】:

我目前正在尝试使用 Plotly 制作一个有四个环的旭日形图。我希望前 3 个内环为浅蓝色,最外环为橙色。

我使用的代码是:

fig = px.sunburst(
    data,
    path=['column', 'column2','column3','column 4'],
    values='column4') 
fig.show()

非常感谢您的帮助!

【问题讨论】:

    标签: python pandas plotly sunburst-diagram


    【解决方案1】:

    设置标记的颜色应该这样做:

    在 javascript 中:

    data = [{
      type: "sunburst",
      labels: ["ring1", "ring2", "ring3", "ring4"],
      parents: ["", "ring1", "ring2", "ring3"],
      marker: {
        colors: [ "steelblue","steelblue","steelblue", "orange"]
      },
    }];
    
    Plotly.newPlot('plotlyDiv1', data);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-05-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-07-22
      • 1970-01-01
      • 2013-12-11
      相关资源
      最近更新 更多