Skip to content

Layout treemap

Place nodes on the screen using a treemap layout.

Transforms a set of columns (normally categorical) to x and y positions using a treemap layout.

The treemap will be created hierarchically according to the order of columns in the input.

At the lowest level of the treemap, points within the same category may be ordered from top to bottom and left to right using an optional numerical column.

Example

The following configuration transforms the categories into a treemap and uses the numerical column to order the nodes in the final squares.

layout_treemap(ds.salary, ds.position, ds.average_montly_hours, {
  "numerical_col": "average_montly_hours",
  "node_size": 8
}) -> (ds.x, ds.y)

Usage

The following are the step's expected inputs and outputs and their specific types.

layout_treemap(*columns: category|number, {"param": value}) -> (x: number, y: number)

where the object {"param": value} is optional in most cases and if present may contain any of the parameters described in the corresponding section below.

Inputs


*columns: column:category|number

Outputs


x: column:number

Numerical column with the x position in the graph.


y: column:number

Numerical column with the y position in the graph.

Parameters


numerical_col: string

Name of the numerical column. Used to order the nodes consecutively in the final treemap.


node_size: integer = 8

Size of the nodes in pixels.

Range: 1 ≤ node_size < inf