Sunburst color levels - R

Sunburst color levels can’t made the same on a single level unless they have the same number of children. I think the solution would be if I could force the sunburst to use the darkest gradient for each color on the first level, regardless of the # of children for each branch. Is that possible?

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"))

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", "#D2CBB8", "#EE5859", "#585859", "#AAAAAA"))

Hi @mrsethward, I’m not sure I understand. Would you like for example Cain, Seth, Abel, Awan and Azura to have the same color? Or the same level of saturation, and then it would be less and less saturated when going to the next levels?

Hi @Emmanuelle, thanks for the reply. I would like it if I could force them to have the same level of saturation at each level. In the first example, since saturation is based on number of levels for the branch, Seth and Cain don’t appear the same even though they were assigned the same color through colorway.

In a similar vein, is it possible to graph each sunburst with the same color and saturation for each element of a branch, like this example from jQuery?

image

Thanks for your help!

Hi @mrsethward, you can set the color of each sector individually with marker=list(color=list(...)). Would that be an option for you?

Hi @Emmanuelle, that is an option for me, thanks, it works great. The only additional need would be adjusting the saturation if possible. Here’s an example making all elements the same color.

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',
        marker = list(colors = list("#EE5859", "#EE5859", "#EE5859", "#EE5859", "#EE5859", "#EE5859", "#EE5859", "#EE5859", "#EE5859")))

image