Skip to content

Reject all matplotlib shorthand color notations in _is_color_like#584

Merged
timtreis merged 1 commit intomainfrom
fix/issue-211-color-shortcuts
Apr 6, 2026
Merged

Reject all matplotlib shorthand color notations in _is_color_like#584
timtreis merged 1 commit intomainfrom
fix/issue-211-color-shortcuts

Conversation

@timtreis
Copy link
Copy Markdown
Member

@timtreis timtreis commented Apr 6, 2026

Summary

  • Fixes Plotting color instead of by var in table and alpha not respected #211: column/gene names like "b", "r", "g", "C0", etc. were misinterpreted as literal matplotlib colors instead of being used for data-driven coloring.
  • Extends _is_color_like() to reject all matplotlib shorthand notations: single-letter colors, CN cycle notation, tab:-prefixed, and xkcd:-prefixed colors.
  • Full-form color names ("red", "blue"), full hex ("#FF0000"), and RGB(A) tuples remain accepted.

Fixes #211. Single-letter colors (b, g, r, …), CN cycle notation (C0, C1, …),
tab: and xkcd: prefixed colors were accepted by _is_color_like, causing column
or gene names that happen to match these shorthands to be interpreted as literal
colors instead of data lookups.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@timtreis timtreis changed the title Reject matplotlib shorthand color notations in _is_color_like Reject **all** matplotlib shorthand color notations in _is_color_like Apr 6, 2026
@timtreis timtreis changed the title Reject **all** matplotlib shorthand color notations in _is_color_like Reject all matplotlib shorthand color notations in _is_color_like Apr 6, 2026
@timtreis timtreis merged commit 0a3f682 into main Apr 6, 2026
8 checks passed
@timtreis timtreis deleted the fix/issue-211-color-shortcuts branch April 6, 2026 10:55
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.44%. Comparing base (db82da8) to head (71c5f06).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #584      +/-   ##
==========================================
+ Coverage   76.30%   76.44%   +0.14%     
==========================================
  Files          11       11              
  Lines        3254     3261       +7     
  Branches      756      759       +3     
==========================================
+ Hits         2483     2493      +10     
+ Misses        467      466       -1     
+ Partials      304      302       -2     
Files with missing lines Coverage Δ
src/spatialdata_plot/pl/utils.py 66.52% <100.00%> (+0.32%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

Plotting color instead of by var in table and alpha not respected

2 participants