代码之家  ›  专栏  ›  技术社区  ›  caldwellst

在R中指定plot-ly-sunburst颜色透明度

  •  0
  • caldwellst  · 技术社区  · 5 年前

    a的每个级别的颜色 sunburst 打印自 plot_ly

    library(plotly)
    
    p <- plot_ly(labels = c("Eve", "Cain", "Seth", "Enos", "Noam", "Abel", "Awan", "Enoch", "Azura"),
        parents = c("", "Eve", "Eve", "Seth", "Seth", "Eve", "Eve", "Awan", "Eve"),
        values = c(65, 14, 12, 10, 2, 6, 6, 4, 4),
        type = 'sunburst',
        branchvalues = 'total')
    layout(p, colorway = c("#EE5859", "#EE5859", "#D2CBB8", "#585859", "#AAAAAA"))
    

    sunburst plot example

    但是,我正在尝试创建在每个级别上具有相同颜色的分支。由于上述行为,我只能相信,如果他们有相同数量的孩子,像下面这样。

    layout(p, colorway = c("#585859", "#EE5859", "#D2CBB8", "#EE5859", "#AAAAAA"))
    

    plotly sunburst example 2

    那么,有没有一种方法可以确定每个级别的太阳辐射的透明度是相同的,并且独立于分支中的级别?在这种情况下,2级为100%,3级为50%?

    0 回复  |  直到 5 年前
    推荐文章