Skip to content

String column names in [0, 1] are now no longer interpreted as colors #331

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

timtreis
Copy link
Member

@timtreis timtreis commented Aug 27, 2024

Matplotlib considers values like "0", "0.3" or "1.0" as valid grey-scale colors. Therefore, colors.is_color_like("0") returns True. This was causing an issue (see linked) for at least one user. This PR introduces a change so that these strings are no longer interpreted as colors.

(The failing tests are fixed in #323)

@timtreis timtreis changed the title Wrapped mpl's is_color_like to be robust to pseudo-bools String column names in [0, 1] are now no longer interpreted as colors Aug 27, 2024
…they-are-not-displayed-by-plrender_shapes-method
@timtreis timtreis merged commit bd285f6 into main Aug 28, 2024
5 checks passed
@timtreis timtreis deleted the bzugfix/327-if-an-obs-column-name-is-0-or-1-they-are-not-displayed-by-plrender_shapes-method branch August 28, 2024 01:39
@codecov-commenter
Copy link

codecov-commenter commented Aug 28, 2024

Codecov Report

Attention: Patch coverage is 83.33333% with 3 lines in your changes missing coverage. Please review.

Project coverage is 79.26%. Comparing base (e97a7fc) to head (9f70cb0).
Report is 1 commits behind head on main.

Files Patch % Lines
src/spatialdata_plot/pl/utils.py 83.33% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #331      +/-   ##
==========================================
- Coverage   79.27%   79.26%   -0.01%     
==========================================
  Files          11       11              
  Lines        1785     1799      +14     
==========================================
+ Hits         1415     1426      +11     
- Misses        370      373       +3     
Files Coverage Δ
src/spatialdata_plot/pl/utils.py 68.04% <83.33%> (+0.15%) ⬆️

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.

If an obs column name is 0 or 1, they are not displayed by pl.render_shapes method
2 participants