Raise on color name collision with column in render_*#665
Merged
Conversation
When `color=<str>` was both a valid matplotlib color and a column name in the element or an annotating table, the literal color silently won and the column was ignored (only a default-hidden `logger.info` was emitted). Now raise `ValueError` with disambiguation guidance: pass hex (e.g. `"#ffa500"`), an RGB(A) tuple, or rename the column.
The three per-render-function tests all routed through the same `_type_check_params` -> `_check_color_column_collision` call. Collapse to two tests in `test_utils.py`, one per code path inside the helper: element-column lookup (points) and annotating-table lookup (shapes).
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #665 +/- ##
==========================================
+ Coverage 77.57% 77.61% +0.03%
==========================================
Files 11 11
Lines 3581 3605 +24
Branches 840 847 +7
==========================================
+ Hits 2778 2798 +20
- Misses 480 484 +4
Partials 323 323
🚀 New features to boost your workflow:
|
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
color=<str>was both a valid matplotlib color name and a column name in the element or an annotating table, the literal color silently won and the column was ignored (only a default-hiddenlogger.infowas emitted). The user got an all-orange plot with no signal.ValueErrornaming the conflicting column location. Disambiguation: pass hex ("#ffa500"), an RGB(A) tuple, or rename the column.render_shapesdocstring updated to reflect the new contract (previously committed to "literal color has precedence over column").Behaviour change
This is a user-visible breaking change in the narrow case where a caller's table or element column happens to share a name with a matplotlib color and they passed
color="<that name>". Those callers were previously getting silently-wrong plots; they now get a clear error with two escape hatches.