Charts
A G-Cubed chartpack selects projection series and organises them into a report. It controls the presentation of baseline projections and experiment results. The model equations, shocks and calculated outcomes stay the same.
Start with examples from a saved G-Cubed model run: real GDP and inflation paths, a regional GDP snapshot and sector-output panels from the 2A build 200 baseline saved on 25 September 2026. These show baseline levels from that saved run.
The illustrated chart guide covers all nine chart families, with complete YAML declarations and matching sample data. Use it to choose a chart for your economic question. For a model-run report, start with real GDP and inflation time paths, regional comparisons in a selected year, sector-output small multiples and deviation heatmaps centred on zero. Reserve compositions and waterfalls for datasets that satisfy their additive accounting requirements. The chart-type guide uses synthetic observations to demonstrate the full feature set; replace those observations with the matching level or deviation output from your model run.
Related YAML documentation: chartpack YAML, chart types, display options and labels, series selectors and setup-generated chartpacks.
A small chartpack
- chartpack:
format: gcubed-chartpack
version: 1
title: Policy experiment
- chart:
title: Inflation
series:
- variable: INFL(USA)
- variable: INFL(CHN)
Keep the chartpack in a .yaml file beside the experiment’s reporting inputs. The run script selects both this file and the HTML report template.
Template compatibility
Numeric version: 1 means the original 1.0.0 format. Later features need a quoted version such as version: "1.4.0". Template support depends on which template was built, rather than its filename alone:
| Chartpack feature | Required format | Required template |
|---|---|---|
| Ordinary line charts, defaults and selectors | 1.0.0 or numeric 1 | Original or later |
| Table of contents | 1.1.0 or later | 1.1 or later |
series-delta bars and series endpoint years | 1.2.0 or later | 1.2 or later |
| Explicit Sector Selection dimensions | 1.3.0 or later | 1.3 or later |
| New chart types, display controls and axis labels | 1.4.0 | 1.4 capable |
The latest template builder reviewed on 25 September 2026 accepts formats 1.0.0 through 1.4.0. Its built template is production-output/template/chart-template.html. Existing models may use copies named chart-template-2.0.html or chart-template-3.0.html; check the actual template selected by the run script. The builder’s 1.4 template also accepts older chartpacks.
Python reporting and setup need matching support. The local gcubedcode checkout reviewed on 25 September 2026 loads chartpack-v1.4.0.schema.json, identical to the reviewed builder schema. Its reporting and setup generator support all nine chart families, including the 1.4 display controls and axis labels. Set version: "1.4.0" in setup when using those features; omission retains numeric 1 and its original feature set.
Use a package and template that both support the chosen features. Existing installed packages or model-local template copies may be older; replacing only the template does not update Python validation or setup generation. The separate layer-contribution export limitation is described below.
The examples document the latest builder’s 1.4 contract. Their copied charts can be viewed directly here, and their paired YAML/CSV can be loaded into a generated report using that template. A raw template is an input to report generation, not an already populated report.
Select model members
Use an exact variable for a known line or a selector to expand a prefix:
- chart:
title: Real GDP by region
series:
- variable_prefix: GDPR
selectors:
regions: all
Selectors are resolved against the target projections. Series sharing an axis must have the same units. A paired-scatter chart may use different units on its two axes.
Selectors decide which series enter a chart. The optional sector_selection_dimensions field has a different job: it decides which set members appear in the HTML page’s Sector Selection control. See sector-selection controls.
Generate chartpacks from setup
Setup uses a concise, model-aware declaration and writes standalone chartpack YAML. The two grammars differ: setup uses ordered selector records and the style key colour; a standalone chartpack uses selector mappings and color.
See generate chartpacks for single and multiple output files.
Projection CSV files
G-Cubed reports use charting projections or deviations written by a run script. These projection data files remain CSV. Their leading columns identify and describe each series:
| Column | Meaning |
|---|---|
| first column | Full G-Cubed variable name |
prefix | Variable-name prefix |
set_member_descriptions | Descriptions of the selected set members |
description | Description of the variable |
units | Units of measurement |
vector | G-Cubed vector type |
region | G-Cubed region associated with the variable |
YYYY columns | Projection values for each year, in order |
When creating a chartpack, start from one for the same model and required format version, then adapt its charts and selectors. Related variable names in the projections CSV can help identify useful series. Keep the chartpack in YAML and the observations in CSV.
Produce the report
The maintained baseline or experiment run script selects the standalone chartpack and produces the report. Setup does not run the model and a standalone chartpack does not calculate derived variables by itself.
See the Reporting overview for the relationship between projections, CSV output, chartpacks and HTML reports. See Derived variables when a chart needs a calculated series that is not an original model variable.
Choose data for the economic question
The chart displays the observations supplied to the report. Select the comparison first, then write its title, caption and axis labels.
| Data supplied | Meaning of a single-year bar | Meaning of a delta bar |
|---|---|---|
| Level projections | The outcome in that year | End-year level minus start-year level |
| Deviations from baseline | The cumulative experiment effect in that year | Change in that cumulative effect between two years |
| Deviations from the preceding simulation layer | The additional effect of that layer in that year | Change in that additional effect between two years |
The units in the CSV determine whether a deviation is a percentage, percentage-point or level difference. series-delta does not calculate a growth rate. Neither type loads a second experiment or constructs a new baseline comparison.
generate_all_simulation_results applies a chartpack to level and deviation data. Choose a pack whose charts and captions make sense for every report it will produce. Composition charts require nonnegative additive levels or shares. Ordinary percentage deviations are not shares and generally cannot be stacked into a meaningful total.
For a composition or a scatter that needs a particular comparison, generate a separate report from the chosen data using generate_html_report, with a package and template that support its chartpack. This is the single-report workflow documented by the builder. The following assumes the experiment’s run script has already prepared projection, the selected data and paths:
from gcubed.reporting import generate_html_report
generate_html_report(
configuration=projection.configuration,
title="Sector output in the policy experiment",
subtitle="Levels in common prices",
documentation_path=documentation_path,
projections=chosen_level_or_share_dataframe,
chartpack_path=composition_chartpack_path,
template_path=report_template_path,
output_path=report_path,
)
Here a dataframe is simply the table of results supplied to reporting. Keep its variable names, units, region and set descriptions, with one column per year. Select the price basis deliberately: gross sector output does not add to GDP, and percentage deviations do not become shares by changing a label.
Prepare a waterfall from simulation layers
For a chosen additive level variable, keep the baseline first and the simulation layers in experiment order. Subtract each layer’s level from the next layer’s level to obtain successive contributions. Include a zero start and a final total equal to the final layer minus baseline.
For example, cumulative levels of 1000, 988, 979, 989 and 992 give contributions of −12, −9, +10 and +3, and a final change of −8. Adding the cumulative baseline deviations at every step would count effects repeatedly. Layer order affects the allocation of contributions.
The latest builder guide documents a reporting-package option, layer_contribution_variables, on generate_all_simulation_results. With exact additive level IDs, it writes projections_data/layer-contributions.csv. That option is not present in the local Python checkout reviewed above; use a package providing it before adding it to a run script. The export does not automatically make waterfall HTML. Supply the contribution CSV with a separate waterfall chartpack to generate_html_report, or load the pair into a generated report using the latest template.
The waterfall example provides a copied chart, matching data and all required YAML roles. Its SYNTH… names are illustrative. Use the actual contribution names and layer order in your results. Check units and reconciliation before interpreting the chart as a decomposition of the experiment effect.
G-Cubed