Hierarchical category visualization
Displaying nested categories or organizational structures as concentric sectors.
Plotly · Class
go.Sunburst creates an interactive hierarchical sunburst trace. Define sectors with labels and connect them through parents, using an empty parent for the root.
go.Sunburst defines a hierarchical chart trace. Provide a label for each sector and identify its immediate parent with parents; use an empty parent for the root, and optionally supply values and branchvalues to control sector sizing.
go.Sunburst(labels=None, parents=None, values=None, branchvalues=None, **kwargs)| Name | Type | Description |
|---|---|---|
labels | array-like | Labels displayed for the sunburst sectors. |
parents | array-like | Parent sector for each label; use an empty string for the hierarchy root. |
values | array-like | Numeric values used to size sectors. |
branchvalues | enumeration | Controls how branch values are interpreted relative to child values. |
A Plotly graph-object Sunburst trace.
import plotly.graph_objects as go
fig = go.Figure(go.Sunburst(
labels=["Eve", "Cain", "Seth", "Enos"],
parents=["", "Eve", "Eve", "Seth"],
values=[10, 4, 6, 3],
branchvalues="total",
))
fig.show()Creates a hierarchical sunburst whose sectors are connected through their parent labels.
Displaying nested categories or organizational structures as concentric sectors.
Comparing quantitative contributions across levels of a tree.
Building a graph-object figure when Plotly Express is not a suitable starting point.
go.Sunburst is a graph-object trace for hierarchical sunburst charts. The essential hierarchy is expressed with labels and parents, where each parent connects a sector to its parent sector.
Follow-up: How is the root represented? The root's parent is an empty string.
labels supplies the displayed sector labels, while parents supplies the parent-sector relationship for each label. The arrays describe corresponding sectors, so their entries must align.
Follow-up: What should be added to size sectors quantitatively? Supply values, and choose an appropriate branchvalues interpretation.
values can provide the numeric size associated with sectors. branchvalues controls how branch values relate to child values; the documentation example uses the total setting for externally calculated branch totals.
Follow-up: What hierarchy condition must still be satisfied? Include a root sector whose parent is represented by an empty string.
plotly.graph_objectsgo.Figureplotly.express.sunburst