Is there a way to change the opacity of the leafs in a plotly.express.sunburst figure?

I don’t like the leaf categories having a different opacity and I couldn’t find the setting to change it.

I found this related topic but I’m using plotly.express instead of plotly.graph_object. Is there a way to change it or do I have to try to change my px-figure into a graph_object? example image

import plotly.express as px
data = dict(
    character=["Eve", "Cain", "Seth", "Enos", "Noam", "Abel", "Awan", "Enoch", "Azura"],
    parent=["", "Eve", "Eve", "Seth", "Seth", "Eve", "Eve", "Awan", "Eve" ],
    value=[10, 14, 12, 10, 2, 6, 6, 4, 4])

fig =px.sunburst(
    data,
    names='character',
    parents='parent',
    values='value',
)
fig.show()

Answer

This works regardless of whether you’ve used Plotly Express or Plotly Graph Objects to build your figure:

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

enter image description here

Complete code:

import plotly.express as px
data = dict(
    character=["Eve", "Cain", "Seth", "Enos", "Noam", "Abel", "Awan", "Enoch", "Azura"],
    parent=["", "Eve", "Eve", "Seth", "Seth", "Eve", "Eve", "Awan", "Eve" ],
    value=[10, 14, 12, 10, 2, 6, 6, 4, 4])

fig =px.sunburst(
    data,
    names='character',
    parents='parent',
    values='value',
)

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

fig.show()