Sankey diagram definitions¶
Sankey diagram definitions (SDDs) describe the structure of the Sankey diagram you want to end up with. They are declarative: you declare what you want up front, but the diagram isn’t created until later. This is useful if you want to use the same diagram structure for different data sources.
-
class
SankeyDefinition
(nodes, bundles, ordering, flow_selection=None, flow_partition=None, time_partition=None)[source]¶
-
class
ProcessGroup
(selection=None, partition=None, direction='R', title=None)[source]¶ A ProcessGroup represents a group of processes from the underlying dataset.
The processes to include are defined by the selection. By default they are all lumped into one node in the diagram, but by defining a partition this can be controlled.
-
selection
¶ list or string – If a list of strings, they are taken as process ids. If a single string, it is taken as a Pandas query string run against the process table.
-
partition
¶ Partition, optional – Defines how to split the ProcessGroup into subgroups.
-
direction
¶ ‘R’ or ‘L’ – Direction of flow, default ‘R’ (left-to-right).
-
title
¶ string, optional – Label for the ProcessGroup. If not set, the ProcessGroup id will be used.
-
-
class
Waypoint
(partition=None, direction='R', title=None)[source]¶ A Waypoint represents a control point along a
Bundle
of flows.There are two reasons to define Waypoints: to control the routing of
Bundle
s of flows through the diagram, and to split flows according to some attributes by setting a partition.-
partition
¶ Partition, optional – Defines how to split the Waypoint into subgroups.
-
direction
¶ ‘R’ or ‘L’ – Direction of flow, default ‘R’ (left-to-right).
-
title
¶ string, optional – Label for the Waypoint. If not set, the Waypoint id will be used.
-
-
class
Bundle
(source, target, waypoints=NOTHING, flow_selection=None, flow_partition=None, default_partition=None)[source]¶ A Bundle represents a set of flows between two :class:`ProcessGroup`s.
-
source
¶ string – The id of the
ProcessGroup
at the start of the Bundle.
-
target
¶ string – The id of the
ProcessGroup
at the end of the Bundle.
-
waypoints
¶ list of strings – Optional list of ids of :class:`Waypoint`s the Bundle should pass through.
-
flow_selection
¶ string, optional – Query string to filter the flows included in this Bundle.
-
flow_partition
¶ Partition, optional – Defines how to split the flows in the Bundle into sub-flows. Often you want the same Partition for all the Bundles in the diagram, see
SankeyDefinition.flow_partition
.
-
default_partition
¶ Partition, optional – Defines the Partition applied to any Waypoints automatically added to route the Bundle across layers of the diagram.
-