Adjust Sunburst Leaf Color/Opacity

Hello,

I am trying to use custom colors in this sunburst chart, but I am unable to adjust the opacity. How can I set the opacity to 100% on everything?

fig =px.sunburst(
    {
        'labels': labels,
        'values': values,
        'parents': parents,
    },
    names='labels',
    values='values',
    parents='parents',
    branchvalues='total',
    color='labels',
    color_discrete_sequence=px.colors.qualitative.Plotly,
    color_discrete_map={
        'Cracked': px.colors.qualitative.Plotly[1],
        'Uncracked': px.colors.qualitative.Plotly[0],
        'Compliant': px.colors.qualitative.Plotly[0],
        'Non-Compliant': px.colors.qualitative.Plotly[1],
    },
)

fig.update_layout(
    height=600,
    template=theme,
    margin=dict(t=0, l=0, r=0, b=0),
    font_color='white',
    font=dict(size=20),
    title_font_color='white',
    paper_bgcolor='rgba(0,0,0,0)',
    plot_bgcolor='rgba(0,0,0,0)'
)

Thanks!

Hi @TheTechromancer,

did you end up finding a solution for this? I’m having the same problem.
I tried setting both extendsunburstcolors=False, and sunburstcolorway in update_layout, but to no avail.

Thanks!

Hi, sorry to disturb on your request help.
But I wantto do the same graph of you, so I copied your code .
But no sunburst display.
Is it possible for you to help me to understande my errors.

Thank you in advance of your help

Best regards
ghizlaine

Thank you for sharing your code with us, @ghizlaine .
Do you mind adding your code within the performatted text symbol (</>) instead of an image?

@adamschroeder
Thank you for response ( I’m starting to Ploty Dash, So I 'm following your youtube video which are Great:))

fig = px.sunburst(
    df1,
    names='sponsored_training(yes_no)',
    values='ID',
    parents='training_done(yes_no)',
    color='sponsored_training(yes_no)',
    color_discrete_sequence=px.colors.qualitative.Pastel,
    branchvalues="total",              
      
)

fig.update_layout(
    height=600,
    
    margin=dict(t=0, l=0, r=0, b=0),
    font_color='white',
    font=dict(size=20),
    title_font_color='white',
    paper_bgcolor='rgba(0,0,0,0)',
    plot_bgcolor='rgba(0,0,0,0)'
)

fig.show()

Thank you
Best regards

ghizlaine

Hi @ghizlaine
can you please share the df1 datafile with us so we can replicated this on our computer? And can you please let us know what error message you’re getting.

fig.update_traces(leaf=dict(opacity = 1))