Visualization¶
Plotting utilities for trade-study results.
trade_study.plot_front(results, directions, *, ax=None, front_kw=None, dominated_kw=None)
¶
Plot a Pareto front from a results table.
For two objectives, draws a 2-D scatter. For three objectives, draws a 3-D scatter. For four or more, draws a pairwise scatter matrix of the first three objectives.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
results
|
ResultsTable
|
Scored results from a study phase. |
required |
directions
|
list[Direction]
|
Optimization direction per observable. |
required |
ax
|
Axes | None
|
Optional axes to draw on (only used for 2-D case). |
None
|
front_kw
|
dict[str, Any] | None
|
Extra keyword arguments for front-point scatter. |
None
|
dominated_kw
|
dict[str, Any] | None
|
Extra keyword arguments for dominated-point scatter. |
None
|
Returns:
| Type | Description |
|---|---|
Figure
|
Tuple of (Figure, Axes). For the pairwise matrix case the |
Axes | ndarray[Any, dtype[Any]]
|
second element is an ndarray of Axes. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If fewer than two objectives are present. |
Source code in src/trade_study/viz.py
trade_study.plot_parallel(results, directions, *, ax=None, cmap='viridis')
¶
Parallel coordinates plot colored by Pareto rank.
Each vertical axis represents one observable, normalized to [0, 1] with the "better" end pointing up. Lines are colored by Pareto rank (0 = front, darker = better).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
results
|
ResultsTable
|
Scored results from a study phase. |
required |
directions
|
list[Direction]
|
Optimization direction per observable. |
required |
ax
|
Axes | None
|
Optional axes to draw on. |
None
|
cmap
|
str
|
Matplotlib colormap name for Pareto-rank coloring. |
'viridis'
|
Returns:
| Type | Description |
|---|---|
tuple[Figure, Axes]
|
Tuple of (Figure, Axes). |
Source code in src/trade_study/viz.py
trade_study.plot_scores(results, observable, directions=None, *, ax=None)
¶
Strip plot of one observable across all configurations.
Each dot is one trial. If directions are provided, Pareto-front designs are highlighted.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
results
|
ResultsTable
|
Scored results from a study phase. |
required |
observable
|
str
|
Name of the observable to plot. |
required |
directions
|
list[Direction] | None
|
If given, highlight Pareto-front designs. |
None
|
ax
|
Axes | None
|
Optional axes to draw on. |
None
|
Returns:
| Type | Description |
|---|---|
tuple[Figure, Axes]
|
Tuple of (Figure, Axes). |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the observable name is not found. |
Source code in src/trade_study/viz.py
trade_study.plot_calibration(nominal, empirical, *, ax=None)
¶
Plot a calibration curve from coverage_curve() output.
Compares nominal coverage levels against empirical coverage. A well-calibrated model follows the diagonal.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
nominal
|
NDArray[floating[Any]]
|
Nominal coverage levels, shape (n_levels,). |
required |
empirical
|
NDArray[floating[Any]]
|
Empirical coverage values, shape (n_levels,). |
required |
ax
|
Axes | None
|
Optional axes to draw on. |
None
|
Returns:
| Type | Description |
|---|---|
tuple[Figure, Axes]
|
Tuple of (Figure, Axes). |