Add overlay unit validation#871
Draft
SimonHeybrock wants to merge 2 commits into
Draft
Conversation
HoloViews silently renders overlaid elements against a single shared axis using the first element's units, producing incorrect plots when sources have mismatched units. This adds validation at two sites: Site 1 (Plotter.compute): validates that all DataArrays in an overlay share the same dimension names, coordinate units, and value units. Errors are caught by the existing try/except and displayed as text. Site 2 (_get_session_composed_plot): validates cross-layer unit compatibility before composing DynamicMaps. Each Plotter stores an OverlayUnitKey after compute(), which captures kdim and vdim unit metadata. ROI readback/request plotters provide kdim units from their coordinate metadata but skip vdim validation. Static plotters are naturally exempt (no Plotter instance). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2df79e8 to
1852b76
Compare
Replace OverlayUnitKey (lossy string-based, weak cross-layer check) with CanvasSpec - a frozen dataclass holding coord_units and value_unit as native sc.Unit values. One validation function (validate_overlay_units) now serves both intra-layer and cross-layer sites with full consistency checks. ROI and annotation plotters opt out via participates_in_overlay_validation class flag, eliminating three _extract_overlay_unit_key overrides. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1852b76 to
af4b525
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
compute()Closes #870
Test plan
🤖 Generated with Claude Code