pythonplotlysunburst-diagram

leave inner circle white in sunburst diagram


On the web I can find many sunburst diagrams where the inner circle is left white which looks better for scientific purposes. But I can't find a way to implement this without a workaround to manipulate the data frame. So my goal is to leave the root node white. Level1 in my example code should be visualized in the second node.

fig = px.sunburst(df, path=['Level1', 'Level2', 'Level3'], values='amount', color='average')

Is there a parameter I am missing?


Solution

  • import plotly.express as px
    df = px.data.tips()
    fig = px.sunburst(df.assign(hole=" "), path=['hole','time', 'sex'], values='total_bill')
    
    fig
    

    enter image description here