nhra_gt.visualization.trajectories¶
Time-Series Trajectory Plotting.
Standard line and swarm plots for simulation history.
Classes¶
Functions¶
plot_trajectory(data, y_col, ylabel, config=None, q_low_col=None, q_high_col=None, **kwargs)
¶
Plots a time-series trajectory with optional quantile ribbons.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
DataFrame
|
DataFrame containing 'year' and the target columns. |
required |
y_col
|
str
|
Column name for the primary metric. |
required |
ylabel
|
str
|
Label for the y-axis. |
required |
config
|
PlotConfig | None
|
PlotConfig object for styling. |
None
|
q_low_col
|
str | None
|
Optional column name for the lower quantile ribbon. |
None
|
q_high_col
|
str | None
|
Optional column name for the upper quantile ribbon. |
None
|
**kwargs
|
Any
|
Additional parameters passed to ax.plot. |
{}
|
Returns:
| Type | Description |
|---|---|
Figure
|
A matplotlib Figure object. |
Source code in src/nhra_gt/visualization/trajectories.py
plot_comparison_trajectory(data, y_col, ylabel, group_col='Scenario', config=None, **kwargs)
¶
Plots multiple trajectories for comparison across scenarios.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
DataFrame
|
DataFrame containing 'year', y_col, and group_col. |
required |
y_col
|
str
|
Column name for the metric. |
required |
ylabel
|
str
|
Label for the y-axis. |
required |
group_col
|
str
|
Column name to group by (e.g. 'Scenario'). |
'Scenario'
|
config
|
PlotConfig | None
|
PlotConfig object. |
None
|
**kwargs
|
Any
|
Passed to ax.plot. |
{}
|
Source code in src/nhra_gt/visualization/trajectories.py
plot_swarm(data, y_col, ylabel, run_col='run', config=None, **kwargs)
¶
Plots a 'swarm' of Monte Carlo trajectories.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
DataFrame
|
DataFrame with 'year', y_col, and run_col. |
required |
y_col
|
str
|
Column name for the metric. |
required |
ylabel
|
str
|
Label for the y-axis. |
required |
run_col
|
str
|
Column name for the MC run ID. |
'run'
|
config
|
PlotConfig | None
|
PlotConfig object. |
None
|
**kwargs
|
Any
|
Passed to ax.plot for individual lines. |
{}
|