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

feat: Add the cerrado sequential colormap #69

Merged
merged 3 commits into from
Jul 24, 2024

Conversation

apcamargo
Copy link
Contributor

This PR adds the cerrado sequential colormap to the contrib namespace. This was created by interpolating three colors (#6e2504, #e1344b, and #f3ccba) with natural spline in the OKLAB space using the coloraide library.

That's the last one of colormaps that I have to contribute for the meanwhile.

cerrado

Copy link

codecov bot commented Jul 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.87%. Comparing base (ebd1de4) to head (96d57c9).

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #69   +/-   ##
=======================================
  Coverage   96.87%   96.87%           
=======================================
  Files         155      155           
  Lines        1981     1982    +1     
=======================================
+ Hits         1919     1920    +1     
  Misses         62       62           

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

Copy link
Member

@tlambert03 tlambert03 left a comment

Choose a reason for hiding this comment

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

very nice, thanks again for your contributions!

@tlambert03 tlambert03 enabled auto-merge (squash) July 24, 2024 13:17
@tlambert03 tlambert03 changed the title Add the cerrado sequential colormap feat: Add the cerrado sequential colormap Jul 24, 2024
@tlambert03 tlambert03 added the enhancement New feature or request label Jul 24, 2024
@tlambert03 tlambert03 merged commit 16a0937 into pyapp-kit:main Jul 24, 2024
15 checks passed
@apcamargo
Copy link
Contributor Author

Happy to contribute!

I'm curious why the perceptual lightness increases linearly in the documentation. Since I didn't use CAM02-UCS and the viscm plot above shows that the derivative of the perceptual lightness varies across the colormap, I was surprised to see that it is linear in the documentation.

@tlambert03
Copy link
Member

If you're curious to see how it's generated, the code used to calculate the y values for that chart is in _util.report (it's the J key in the return dict).

@tlambert03
Copy link
Member

tlambert03 commented Jul 25, 2024

Might be a javascript/chart issue actually... if you hover on the delta values they range very similarly to your data, between 50-60 or so... actually might just be a weirdly scaled right axis

@apcamargo
Copy link
Contributor Author

The perceptual lightness curve appears incorrect; it should exhibit a slight bump rather than being a straight line. However, I did not find any apparent issues with the code. Maybe the curves are there but it is very subtle.

@tlambert03
Copy link
Member

i believe it's just the scaling of the Y axis: hover over the values and you'll see that the deltas match the perceptual lightness derivative from your graph (ranging from ~50 to 60+ and then back down a bit):

Screenshot 2024-08-05 at 7 14 29 PM Screenshot 2024-08-05 at 7 14 52 PM Screenshot 2024-08-05 at 7 14 58 PM

I pinned the range of deltas (right Y axis) to -500 --> + 500 globally right here. This was so that A) one could generally look at many colormaps and say "is this generally linear compared to the others" without having to carefully look at the Y axis and know what range other colormaps have, ... and so that B) the grid on the graph is clean

I can see that it gives the impression in your colormap of perfect linearity, while it is in fact, slightly nonlinear. But, relative to some others, it is indeed rather linear. Open to suggestions if you'd like to suggest a new presentation option

@apcamargo
Copy link
Contributor Author

Yeah, I think you're right. I don't have any suggestions, it looks pretty good as is. Other than changing the range of the right Y axis, I don't see any other way to "fix" this. Is there any reason you set a large interval there?

@tlambert03
Copy link
Member

tlambert03 commented Aug 5, 2024

Is there any reason you set a large interval there?

that was what I was trying to explain above:

This was so that A) one could generally look at many colormaps and say "is this generally linear compared to the others" without having to carefully look at the Y axis and know what range other colormaps have, ... and so that B) the grid on the graph is clean

to clarify: -500-+500 was a range that fit the the full range of deltas seen across all colormaps, so, for example, turbo covers a decent part of it:

Screenshot 2024-08-05 at 7 26 51 PM

and others probably cover even more.

it does seem a bit random and large for a one-off linear colormap. but that was the intention (to foster comparisons against others)

see also https://cmap-docs.readthedocs.io/en/latest/catalog/miscellaneous/yorick%3Ancar/

@apcamargo
Copy link
Contributor Author

Ohh, I understand it now.

I don't see any reason for a change then. It's pretty good like this. I doubt such small deviations from a linear colormap are relevant enough to justify any changes.

@tlambert03
Copy link
Member

Thanks for the eagle-eyed question :)

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.

2 participants