Skip to content

feat: add original-vs-reconstructed compare plot (plot_compare) - #96

Closed
FBumann wants to merge 1 commit into
feat/compare-original-reconstructedfrom
feat/plot-compare
Closed

feat: add original-vs-reconstructed compare plot (plot_compare)#96
FBumann wants to merge 1 commit into
feat/compare-original-reconstructedfrom
feat/plot-compare

Conversation

@FBumann

@FBumann FBumann commented Jul 20, 2026

Copy link
Copy Markdown
Owner

Closes #95.

Adds AggregationResult.plot_compare() — a one-call plotly figure for the most common post-aggregation check.

Note

Stacked on #93. This builds on the compare() / to_dataframe() helpers from that PR, so it's based on feat/compare-original-reconstructed, not main. Merge #93 first, then rebase/retarget this onto main (GitHub will offer to retarget automatically once #93 lands).

API

agg.plot_compare(*, kind="timeseries", **sel) -> plotly.graph_objects.Figure
  • Overlays original (dotted) vs reconstructed (solid) on the original time axis, built from to_dataframe().
  • Colours by cluster column (falls back to colouring by variant when there's no cluster dim); facets over slice dims (period/scenario) when present.
  • kind="timeseries" (default) or kind="duration_curve" (each series sorted descending).
  • **sel selects a subset, e.g. plot_compare(variable="solar"); omit to plot all columns.
  • Optional-plotly import guarded with a helpful message, matching TuningResult.plot().

Deviation from the issue's sketch

The issue proposed plot_compare(variable=None, ...). I used **sel instead so it composes with the existing compare(**sel)/to_dataframe(**sel) and handles arbitrary/multiple cluster-dim names (not just one called variable). plot_compare(variable="solar") still works exactly as sketched.

Tests

TestPlotCompare (5): faceting over a slice dim, single-column selection, duration curve, no-cluster-dim colouring, invalid-kind error. Full suite: 533 passed / 4 skipped. mypy + ruff clean; getting-started notebook executes end-to-end and demonstrates the helper.

🤖 Generated with Claude Code

…nResult

Adds a plotly convenience plot built on the compare()/to_dataframe() helpers,
the most common check after aggregating. Overlays original (dotted) vs
reconstructed (solid), colours by cluster column, and facets over slice dims.

- kind="timeseries" (default) or "duration_curve" (sorted descending)
- **sel selects a subset (e.g. variable="solar"); omit to plot all columns
- optional plotly dependency guarded with a helpful message, matching
  TuningResult.plot()
- getting-started notebook demonstrates the one-call helper

Closes #95

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 26de3155-cbbb-4a0a-8fa4-e5a4d94a7d3b

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/plot-compare

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant