Skip to content
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

Expose Colormap.num_colors and document usage for cycling through qualitative colormaps #55

Merged
merged 4 commits into from
May 17, 2024

Conversation

andy-sweet
Copy link
Contributor

Closes #54

Here's a quick attempt at the basic additions described in #54. Along with a rough attempt at document usage of qualitative colormaps more generally.

Not quite ready for review, but any feedback about anything is welcome - structure and style included.

As I wrote this, I do feel a stronger need for something like Colormap(x, cycle=True) or Colormap.cycle(x) to handle iterable/ndarray inputs, but haven't gone there yet.

Copy link

codecov bot commented May 16, 2024

Codecov Report

Attention: Patch coverage is 80.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 96.86%. Comparing base (d085c10) to head (2a325d9).
Report is 17 commits behind head on main.

Files Patch % Lines
src/cmap/_colormap.py 80.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main      #55   +/-   ##
=======================================
  Coverage   96.85%   96.86%           
=======================================
  Files         152      152           
  Lines        1972     1975    +3     
=======================================
+ Hits         1910     1913    +3     
  Misses         62       62           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@andy-sweet andy-sweet changed the title [WIP] Expose Colormap.num_colors and document usage for cycling through qualitative colormaps Expose Colormap.num_colors and document usage for cycling through qualitative colormaps May 17, 2024
@andy-sweet andy-sweet marked this pull request as ready for review May 17, 2024 15:59
@andy-sweet
Copy link
Contributor Author

Addressed the PR comments. The codecov patch check failed, but given the code changes here, I don't see a need to add more tests.

equivalent call to the above is

```python
c(np.linspace(0, 2, 16, endpoint=False) % 1)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

endpoint=False 🤯 😂 can't believe i hadn't found that

@tlambert03
Copy link
Owner

thanks @andy-sweet!

@tlambert03 tlambert03 merged commit 12cc5e8 into tlambert03:main May 17, 2024
14 of 15 checks passed
@tlambert03 tlambert03 added the enhancement New feature or request label May 17, 2024
@andy-sweet andy-sweet deleted the feat-expose-num-colors branch May 17, 2024 21:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature: improve ergonomics for cyclic qualitative/categorical colormaps
2 participants