C3 AI Documentation Home

Sankey

Create a Sankey diagram in Visual Notebooks. A Sankey diagram is a type of flow chart that shows how values change from one condition to another. A Sankey diagram is particularly useful when visualizing complex flows with multiple layers of conditions.

Configuration

FieldDescription
Select visualization typeChart type selection An option to select a different chart type.
Source ColumnThe feature with the source condition Select the column containing the feature that is the starting condition.
Target ColumnThe feature with the target condition Select the column containing the feature that is the target condition.
Value ColumnSelect value of the flow Optionally select a numeric column that represents the values of each instance of the start and end conditions. When the value column is not selected, the Sankey diagram uses the count of each source and destination as their aggregated value.
AggregationSelect value aggregation type Identify how you want to aggregate your source and destination values. Aggregation methods include Average, Minimum, Maximum, and Sum.
Missing Value TreatmentDealing with missing values Select Impute missing to fill numeric missing values with the mean of the values that have the same source and target combination. Select Drop rows with missing values in any of the selected columns to remove rows with missing values.

Visualization Settings

General

FieldDescription
TitleTitle for the chart An optional title that appears at the top of the chart.
Color ThemeVisualization color scheme Select Colorful, Monochrome, or Grayscale.
OrientationOrientation of Sankey diagram Select Horizontal or Vertical orientation.

Nodes

FieldDescription
Node AlignmentSelect node alignment Align your nodes to the Left, align them to the Right, or Justify the alignment.
Node Text AlignmentAlign the description text relative to the node Align the text to the Left, Right, or Center of the node.
Node ColorChoose color scheme of nodes Select Equal colors, Color by level, or Color nodes individually
Node Decal PatternUse decal pattern for nodes Toggle to turn on or off the decal pattern for nodes
FieldDescription
Link ColorsAdjust node color Choose the link color to be the same as the Source node color, same as the Target node color, Gradient from source to target, or the color Grey

Node Inputs/Outputs

InputA Visual Notebooks dataframe
OutputA Sankey diagram in Visual Notebooks

Example Sankey diagram

Figure 1: Example Sankey diagram

Examples

The following examples use a Sankey diagram to show how energy flows from different sources (how the energy is generated) to their destinations (how the energy is consumed).

  1. Connect an existing node to the Sankey node.
  2. Select a field for the source. In this case, Source is selected in the source column.
  3. Select a field for the target. In this case, Target is selected in the target column.
  4. To show the amount of energy, instead of just the count of each category, Value is selected as the value column.
  5. Select Sum as the aggregation as it's important to show the total amount of energy flow in this case
  6. Select Apply.

Figure 2 shows a Sankey diagram across different energy sources.

Example basic scatter plot

Figure 2: Example basic Sankey diagram

Adjust the settings in the Configure Visualization Settings menu. In this case, the defaults were changed to these selections:

  1. Title: US Energy Flow
  2. Node alignment: Justify

The dataframe in Figure 3 shows the same chart with the nodes justified and a new title.

Example configured scatter plot

Figure 3: Example configured Sankey diagram

Was this page helpful?