Treemap
treemap() over named columns of a dataframe_mojo DataFrame (#743). Each argument names a column instead of holding the values.
Usage
from dataviz import treemap
from dataviz import save
def main() raises:
# The same illustrative portfolio used by the sunburst example:
# annual revenue by product line ($M), grouped into divisions.
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 = treemap(
ids,
parent_ids,
revenue,
title="Illustrative Product Portfolio Revenue ($M)",
)
save(c, "docs/src/examples/out_treemap.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 · Dendrogram
Relevant API: treemap