liam beck
liam beck

Reputation: 77

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?

Upvotes: 1

Views: 707

Answers (1)

Rob Raymond
Rob Raymond

Reputation: 31206

  • this is manipulating dataframe, but in transient way
  • it is simple and transparent
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

Upvotes: 3

Related Questions