Sunburst
Sunburst
A sunburst chart.
Usage
from dataviz_mojo import sunburst
from dataviz_mojo.plot import save
def main() raises:
var ids: List[String] = ["root", "src", "docs", "main.py", "utils.py", "guide.md", "api.md"]
var parent_ids: List[String] = ["", "root", "root", "src", "src", "docs", "docs"]
var sizes: List[Float64] = [0.0, 0.0, 0.0, 45.0, 20.0, 12.0, 8.0]
var c = sunburst(ids, parent_ids, sizes)
save(c, "docs/src/examples/out_sunburst.svg")Args:
ids: Every node’s unique id, flattened (not nested), one entry per node.parent_ids: Each node’s parent id (must be a value present inids, or empty for a root); paired withids[i].values: Each leaf node’s size; an internal node’s size is the sum of its descendants’ – seePlot.encode_hierarchy()’s docstring for the exact rule.theme: Full styling knobs beyond this function’s own parameters (colors, margins, fonts, gridlines, …) – seeTheme’s docstring.width: Pixel width of the returnedPlot(.size()).height: Pixel height of the returnedPlot(.size()).title: The chart’s title, shown above the plot.subtitle: A secondary line shown under the title.x_title: The x-axis caption.y_title: The y-axis caption.