Skip to content

Sunburst

sunburst() over named columns of a dataframe_mojo DataFrame (#743). Each argument names a column instead of holding the values.

Sunburst

Usage

from dataviz import sunburst
from dataviz import save

def main() raises:
    # Illustrative annual revenue by product line ($M). Internal nodes
    # are zero: their area is derived from their children's values.
    var ids: List[String] = [
        "Portfolio", "Cloud", "Commerce", "Data",
        "Compute", "Storage", "Security",
        "Checkout", "Subscriptions", "Marketplace",
        "Warehouse", "Streaming", "Governance",
    ]
    var parent_ids: List[String] = [
        "", "Portfolio", "Portfolio", "Portfolio",
        "Cloud", "Cloud", "Cloud",
        "Commerce", "Commerce", "Commerce",
        "Data", "Data", "Data",
    ]
    var revenue: List[Int] = [
        0, 0, 0, 0, 48, 31, 24, 42, 28, 19, 36, 22, 14,
    ]

    var c = sunburst(
        ids,
        parent_ids,
        revenue,
        title="Illustrative Product Portfolio Revenue ($M)",
    )
    save(c, "docs/src/examples/out_sunburst.svg")

See Data shapes for shared input conventions.

Args:

  • df: The frame to read.
  • ids: The string column for this channel.
  • parent_ids: The string column for this channel.
  • values: The numeric column for this channel.
  • theme: See the list overload.
  • width: See the list overload.
  • height: See the list overload.
  • title: See the list overload.
  • subtitle: See the list overload.
  • x_title: See the list overload.
  • y_title: See the list overload.

Related

Related charts: Tree

Relevant API: sunburst