-
Notifications
You must be signed in to change notification settings - Fork 52
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
Adds functionality for inverting colormap lightness #106
Conversation
I see this! Hope to get to it today. 🌈 |
🌈 as a happy symbol of course, not as an implicit endorsement of using rainbow colormaps. |
@andrew-s28 I realize now I didn't give feedback on this in your original issue, but I'm interested in having the "_i" or "_inverted" access to these colormaps. How hard would this be to implement, and would it take much time to calculate on the fly if a user called it? I think it would be much more user-friendly since I doubt that many users of cmocean use the tools at all. Though I do appreciate your concern it might be confusing to have more underscore-based names, especially since I don't know of any more conventions besides "_r". |
@kthyng Thanks for the review! It would be straightforward to add access to the inverted colormaps via an _i appendix instead of the way it is now. I could implement it such that order of the appendix does not matter (whether _r or _i comes first). There is very little overhead to calling the inversion on the fly, so I think it would be fine to implement it such that whatever colormap the user calls is passed to the inverting function when they call it. An alternative would be to include the inverted colormaps into -rgb.txt files, similar to how the existing colormaps are implemented. This option does have the advantage that the inverted colormaps would be generated ahead of time and thus would not require the addition of the Let me know which way you think would be best. |
Ah, yes, people always like to limit the dependencies. Also many other packages have included the rgb files directly so this would have the advantage of being able to pass them forward if anyone is interested. I would lean this way even if it seems a bit more brute force. What do you think? |
I admit to being one of those people - I tend to be wary of suggesting additional dependencies, especially to a well-established package and since I actually prefer the brute force solution myself as well, it also prevents any future maintenance issues with the additional function in |
@andrew-s28 Yes I think that with some good documentation (is that in this same repo? it's been awhile since I updated that and I wrote all this a long time ago) and also maybe multiple aliases this will be clear enough. What about making available both or all |
@kthyng Seems like a reasonable plan to me, I think I will implement it such that if a The documentation is in this repo, so I will add a short description of inverted colormaps to the docs with this PR as well. |
- updates plots.py so that example plots are unchanged by additions - adds documentation for inverted cmaps
acde30c
to
12cd24e
Compare
@kthyng I have updated the PR to used hard-coded rgb files for the inverted colormaps, accessible with a Documentation is added right after the documentation for reversed colormaps. I also made a few changes to the |
@andrew-s28 Ack sorry this came in at a particularly busy time and then moved down the email list. I'll get to it today or tomorrow I think. |
@andrew-s28 This looks really great!! I'm going to accept and then will process it on through. |
I went with the option of adding the function
invert_lightness
tocmocean.tools
, since having more than just an _r subscript on colormaps would be confusing.This solution does require adding
colorspacious
as a dependency tocmocean
.Closes #105
Here is an example of the inverted lightness colormaps: