Skip to content
masterclassBuddyTech Buzz5 fresh blogs · 5:00 AM IST

Plotly · Class

go.Sunburst

go.Sunburst creates an interactive hierarchical sunburst trace. Define sectors with labels and connect them through parents, using an empty parent for the root.

How it works

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.

Syntax

go.Sunburst(labels=None, parents=None, values=None, branchvalues=None, **kwargs)

Parameters

NameTypeDescription
labelsarray-likeLabels displayed for the sunburst sectors.
parentsarray-likeParent sector for each label; use an empty string for the hierarchy root.
valuesarray-likeNumeric values used to size sectors.
branchvaluesenumerationControls how branch values are interpreted relative to child values.

Returns

A Plotly graph-object Sunburst trace.

Key points

  • Use go.Sunburst when the more specialized Plotly Express interface is not a suitable starting point.
  • The labels argument supplies the names shown for the sunburst sectors.
  • The parents argument encodes the hierarchy by assigning each sector to its parent.
  • Represent the top-level node by giving it an empty-string parent.

Common mistakes

  • Mark the hierarchy's root with an empty string in the corresponding parents entry.
  • Each parents entry must identify the sector's immediate parent, not an arbitrary ancestor.

Example: Basic hierarchical sunburst

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.

When to use it

Hierarchical category visualization

Displaying nested categories or organizational structures as concentric sectors.

Part-to-whole analysis

Comparing quantitative contributions across levels of a tree.

Low-level trace construction

Building a graph-object figure when Plotly Express is not a suitable starting point.

Interview questions

QWhat does go.Sunburst represent, and which fields define its hierarchy?

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.

QWhat are the roles of labels and parents?

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.

QHow can numeric sector sizes be configured?

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_objects
  • go.Figure
  • plotly.express.sunburst

Source: Sunburst. Checked 2026-10-15.