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

Implemented STD Gamma II interpolator #35

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Conversation

niconoe
Copy link

@niconoe niconoe commented Apr 16, 2021

Hi,

I've recently had to implement a color scheme to mimic IDL's "Std Gamma II" color scale. I think it's nice to also share it with the community!

Thanks,

@Fil
Copy link
Member

Fil commented Apr 16, 2021

Thanks! Here's what it gives on my screen:

Capture d’écran 2021-04-16 à 10 10 36

It seems to be reversed wrt the original, is this expected?

@niconoe
Copy link
Author

niconoe commented Apr 16, 2021

Good catch! Indeed, I implemented it reversed because that's also what the project I had to reimplement (bioRad) was doing.

I think we can either:

  • keep it reversed code-wise, but change the link in documentation (change the reference to https://adriaandokter.com/bioRad/#vertical-profile-data-example since they were my inspiration and the ones that decided first to reverse the IDL scale)
  • reverse the code output so we match IDL's initial idea and the current documentation (I'll adapt my project to reverse it before use)

Any preference?

@Fil
Copy link
Member

Fil commented Apr 16, 2021

I don't know if we want to support this interpolator, it seems that it has quite a few issues in itself (like these very sharp bands on "pure" colors); and the implementation implies a structural change by requiring d3-scale (which might not be a problem, but is something new).
But if we do, it will be better if wasn't reversed, so as not to add confusion.
Note that this is not a reflection on its usefulness or quality of the contribution; there are lots of color interpolators that live outside the d3-scale-chromatic project, like Fabio Crameri's https://observablehq.com/@fil/colormaps https://observablehq.com/@nitaku/fabio-crameris-color-schemes . I would love to see a comprehensive archive of color schemes, but I wonder if that should be in this D3 module.

@niconoe
Copy link
Author

niconoe commented Apr 16, 2021

Thanks for the quick feedback, @Fil!

A few random comments:

  • I de-reversed the interpolator, in case you eventually choose to add it!
  • I was also concerned about the addition of the d3-scale requirement. I actually contemplated reimplementing a simple piecewise linear scales in pure JS to avoid that situation, but I came to the conclusion that the reinventing the wheel was worse than importing another nice D3 tool. Tell me if I'm wrong.
  • I also understand the main question: should this repository become a comprehensive archive of color schemes. Good question, and I think you're in a better position than me to make this call :) From my point of view as a newbie D3 user: it would be nice to have somewhere a single entry point (repository of color schemes / interpolators that we can quickly browse when we need to choose a color scheme for a project). And I naively/lazily assumed it was this repo since it's what we immediately get when googling terms such as "D3 color scales".

Anyway, thanks already for your work and for considering this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants