Summary
AggregationResult exposes original, reconstructed, residuals, and accuracy as data, but there's no built-in way to visualize how well the clustering reproduces the input. Eyeballing original-vs-reconstructed is the single most common thing users do after aggregating, and today everyone hand-rolls the plotly/matplotlib code for it.
There's already a plotting precedent in the package — TuningResult.plot() (RMSE vs timesteps) — and plotly is already an optional dependency there, so a comparison plot fits naturally alongside it.
Proposal
Add a plotting helper on AggregationResult, e.g.:
agg.plot_compare(variable=None, *, kind="timeseries") # -> plotly Figure
- Overlays
original vs reconstructed on the original time axis.
variable=None plots all columns (color by column); a name/list selects a subset.
kind="timeseries" (default) and kind="duration_curve" (sorted descending).
- Distinguish the two series clearly (e.g. Original dotted / Reconstructed solid).
- Faceting over slice dims (period/scenario) when present.
try: import plotly ... except ImportError: raise with a helpful message, matching TuningResult.plot().
This pairs with the tidy-data helper proposed in #92: compare()/to_dataframe() return the data; plot_compare() returns the ready figure built from it.
Motivation / context
Downstream, flixopt just re-added a clustering.plot.compare() wrapper (flixOpt/flixopt#734) precisely because this plot was missing — it restores functionality users lost. If the plot lived here, that wrapper would become a thin dim-name adapter (or go away), and non-flixopt users of tsam_xarray would get the same convenience.
Happy to send a PR.
Summary
AggregationResultexposesoriginal,reconstructed,residuals, andaccuracyas data, but there's no built-in way to visualize how well the clustering reproduces the input. Eyeballing original-vs-reconstructed is the single most common thing users do after aggregating, and today everyone hand-rolls the plotly/matplotlib code for it.There's already a plotting precedent in the package —
TuningResult.plot()(RMSE vs timesteps) — and plotly is already an optional dependency there, so a comparison plot fits naturally alongside it.Proposal
Add a plotting helper on
AggregationResult, e.g.:originalvsreconstructedon the original time axis.variable=Noneplots all columns (color by column); a name/list selects a subset.kind="timeseries"(default) andkind="duration_curve"(sorted descending).try: import plotly ... except ImportError: raisewith a helpful message, matchingTuningResult.plot().This pairs with the tidy-data helper proposed in #92:
compare()/to_dataframe()return the data;plot_compare()returns the ready figure built from it.Motivation / context
Downstream, flixopt just re-added a
clustering.plot.compare()wrapper (flixOpt/flixopt#734) precisely because this plot was missing — it restores functionality users lost. If the plot lived here, that wrapper would become a thin dim-name adapter (or go away), and non-flixopt users of tsam_xarray would get the same convenience.Happy to send a PR.