Population Pyramid

Rebuilds the population pyramid with diverging-bar layout rows and symmetric horizontal intervals.

Population Pyramid
Gallery Population Pyramid Pipeline pipeline

Data Sources

6

Fields

21

Scales

3

Layers

11

Glyphs

60

rect 41 / line 10 / text 9

male and female diverging bars panel-2-101285+ / male: 0.3185+ / female: 0.4880-84 / male: 0.4280-84 / female: 0.5575-79 / male: 0.5875-79 / female: 0.6870-74 / male: 0.8270-74 / female: 0.9165-69 / male: 1.0565-69 / female: 1.1260-64 / male: 1.2260-64 / female: 1.2655-59 / male: 1.3555-59 / female: 1.3850-54 / male: 1.4250-54 / female: 1.4345-49 / male: 1.4845-49 / female: 1.4740-44 / male: 1.5640-44 / female: 1.5235-39 / male: 1.6635-39 / female: 1.5830-34 / male: 1.8230-34 / female: 1.7225-29 / male: 1.7425-29 / female: 1.6620-24 / male: 1.6220-24 / female: 1.5515-19 / male: 1.5815-19 / female: 1.5110-14 / male: 1.6110-14 / female: 1.545-9 / male: 1.685-9 / female: 1.60-4 / male: 1.650-4 / female: 1.58malefemalePopulation

Build Path

Gallery Population Pyramid Pipeline

This example is rebuilt from gallery data source age-population by recipe populationPyramid: raw table rows -> TabularSource -> pipeline drafts -> analyzeAuthoringDrafts() -> materialized ChartSpec -> compileChart() -> SceneGraph -> SVG. The graph below shows the authored pipeline stage.

Pipeline recipe graph

9 pipelines
10 nodes
15 edges

Data Flow Diagram

0/648 nodes
0/1282 edges
648 hidden

Select a glyph to highlight its complete source path.

Scope

Roles

source
transform
field
scale
layer
param
glyph

No matching flow nodes

Adjust search, scope, or role filters.

Available Data

6 tables
1 transforms

Imported table

source_gallery_populationpyramid
raw
6 columns
feeds pipeline_diverging_bar_layout_transform

ChartSpec

{
  "id": "gallery.populationPyramid",
  "data": [
    {
      "id": "source_gallery_populationpyramid",
      "rows": 18
    },
    {
      "id": "source_pyramid_segments",
      "rows": 36
    },
    {
      "id": "__guide.pipeline_xgrid_guide",
      "rows": 5
    },
    {
      "id": "__guide.pipeline_xaxis_guide",
      "rows": 5
    },
    {
      "id": "__guide.pipeline_colorlegend_guide",
      "rows": 2
    },
    {
      "id": "__guide.pipeline_colorlegend_guide.title",
      "rows": 1
    }
  ],
  "transforms": [
    {
      "id": "pipeline_diverging_bar_layout_transform",
      "type": "layout",
      "input": "source_gallery_populationpyramid",
      "output": "source_pyramid_segments",
      "options": {
        "count": 1,
        "errorMethod": "standardError",
        "fit": "contain",
        "groupBy": [
          "agegroup"
        ],
        "includeMax": true,
        "leftField": "male",
        "leftLabel": "male",
        "layout": "pipeline_male_and_female_diverging_bars_panel_layout",
        "layoutKind": "divergingBars",
        "layoutMode": "proportionalAngle",
        "mode": "normal",
        "order": [],
        "rightField": "female",
        "rightLabel": "female"
      }
    }
  ],
  "axes": [
    {
      "id": "pipeline_xaxis_guide",
      "scale": "pipeline_signedvalue_x_x_scale",
      "orientation": "bottom"
    }
  ],
  "grids": [
    {
      "id": "pipeline_xgrid_guide",
      "scale": "pipeline_signedvalue_x_x_scale",
      "orientation": "x"
    }
  ],
  "legends": [
    {
      "id": "pipeline_colorlegend_guide",
      "scale": "pipeline_side_color_color_scale",
      "kind": "color",
      "title": "Population"
    }
  ],
  "fields": [
    "__rowLabel",
    "male",
    "female",
    "id",
    "agegroup",
    "direction",
    "end",
    "formatted",
    "side",
    "signedValue",
    "start",
    "tooltip",
    "value",
    "label",
    "x",
    "y",
    "symbolX",
    "symbolY",
    "labelX",
    "labelY",
    "text"
  ],
  "scales": [
    {
      "id": "pipeline_signedvalue_x_x_scale",
      "type": "linear",
      "domain": {
        "source": "field",
        "data": "source_pyramid_segments",
        "field": "signedValue",
        "fields": [
          "start",
          "end",
          "signedValue"
        ],
        "includeZero": true,
        "order": "input",
        "reverse": false,
        "symmetric": true
      }
    },
    {
      "id": "pipeline_agegroup_y_y_scale",
      "type": "band",
      "domain": {
        "source": "field",
        "data": "source_pyramid_segments",
        "field": "agegroup",
        "fields": [],
        "includeZero": false,
        "order": "input",
        "reverse": false,
        "symmetric": false
      }
    },
    {
      "id": "pipeline_side_color_color_scale",
      "type": "ordinal",
      "domain": {
        "source": "field",
        "data": "source_pyramid_segments",
        "field": "side",
        "fields": [],
        "includeZero": false,
        "order": "input",
        "reverse": false,
        "symmetric": false
      }
    }
  ],
  "layers": [
    {
      "id": "pipeline_xgrid_guide",
      "mark": "line",
      "role": "guide"
    },
    {
      "id": "pipeline_xaxis_guide-tick-marks",
      "mark": "line",
      "role": "guide"
    },
    {
      "id": "pipeline_xaxis_guide-labels",
      "mark": "text",
      "role": "guide"
    },
    {
      "id": "pipeline_colorlegend_guide-swatches",
      "mark": "rect",
      "role": "guide"
    },
    {
      "id": "pipeline_colorlegend_guide-labels",
      "mark": "text",
      "role": "guide"
    },
    {
      "id": "pipeline_colorlegend_guide-title",
      "mark": "text",
      "role": "guide"
    },
    {
      "id": "create_chart_surface",
      "mark": "rect",
      "role": "context"
    },
    {
      "id": "pipeline_male_and_female_diverging_bars_panel_layout_surface",
      "mark": "rect",
      "role": "context"
    },
    {
      "id": "pipeline_male_and_female_diverging_bars_panel_layout_frame",
      "mark": "rect",
      "role": "guide"
    },
    {
      "id": "pipeline_male_and_female_diverging_bars_panel_layout_label",
      "mark": "text",
      "role": "guide"
    },
    {
      "id": "pipeline_male_and_female_diverging_bars_segments_layer",
      "mark": "rect",
      "role": "data"
    }
  ]
}

Resolved SceneGraph

{
  "scene": "gallery.populationPyramid.scene",
  "scales": [
    {
      "id": "pipeline_signedvalue_x_x_scale",
      "type": "linear",
      "domain": [
        -2,
        2
      ],
      "range": [
        72,
        718
      ],
      "ticks": [
        -2,
        -1,
        0,
        1,
        2
      ]
    },
    {
      "id": "pipeline_agegroup_y_y_scale",
      "type": "band",
      "domain": [
        "85+",
        "80-84",
        "75-79",
        "70-74",
        "65-69",
        "60-64",
        "55-59",
        "50-54",
        "45-49",
        "40-44",
        "35-39",
        "30-34",
        "25-29",
        "20-24",
        "15-19",
        "10-14",
        "5-9",
        "0-4"
      ],
      "range": [
        386,
        42
      ],
      "bandwidth": 17.2
    },
    {
      "id": "pipeline_side_color_color_scale",
      "type": "ordinal",
      "domain": [
        "male",
        "female"
      ],
      "range": [
        "var(--colors-blue-9)",
        "var(--colors-orange-9)",
        "var(--colors-green-9)",
        "var(--colors-purple-9)"
      ]
    }
  ],
  "layers": [
    {
      "id": "create_chart_surface",
      "role": "context",
      "zIndex": -10,
      "glyphs": 1
    },
    {
      "id": "pipeline_xgrid_guide",
      "role": "guide",
      "zIndex": 0,
      "glyphs": 5
    },
    {
      "id": "pipeline_male_and_female_diverging_bars_panel_layout_surface",
      "role": "context",
      "zIndex": 0,
      "glyphs": 1
    },
    {
      "id": "pipeline_male_and_female_diverging_bars_panel_layout_frame",
      "role": "guide",
      "zIndex": 1,
      "glyphs": 1
    },
    {
      "id": "pipeline_male_and_female_diverging_bars_panel_layout_label",
      "role": "guide",
      "zIndex": 2,
      "glyphs": 1
    },
    {
      "id": "pipeline_xaxis_guide-tick-marks",
      "role": "guide",
      "zIndex": 5,
      "glyphs": 5
    },
    {
      "id": "pipeline_xaxis_guide-labels",
      "role": "guide",
      "zIndex": 20,
      "glyphs": 5
    },
    {
      "id": "pipeline_male_and_female_diverging_bars_segments_layer",
      "role": "data",
      "zIndex": 20,
      "glyphs": 36
    },
    {
      "id": "pipeline_colorlegend_guide-swatches",
      "role": "guide",
      "zIndex": 40,
      "glyphs": 2
    },
    {
      "id": "pipeline_colorlegend_guide-labels",
      "role": "guide",
      "zIndex": 41,
      "glyphs": 2
    },
    {
      "id": "pipeline_colorlegend_guide-title",
      "role": "guide",
      "zIndex": 42,
      "glyphs": 1
    }
  ]
}

Glyph Data Tree

11 layers

Full parameter lineage for the active compiler surface.

create_chart_surface

1

pipeline_xgrid_guide

5

pipeline_male_and_female_diverging_bars_panel_layout_surface

1

pipeline_male_and_female_diverging_bars_panel_layout_frame

1

pipeline_male_and_female_diverging_bars_panel_layout_label

1

pipeline_xaxis_guide-tick-marks

5

pipeline_xaxis_guide-labels

5

pipeline_male_and_female_diverging_bars_segments_layer

36

pipeline_colorlegend_guide-swatches

2

pipeline_colorlegend_guide-labels

2

pipeline_colorlegend_guide-title

1

Glyph Inspector

none

Select a glyph in the chart to inspect resolved params and lineage.