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

Support specifying a midpoint / etc. in quantitative color scaling #365

Open
fedarko opened this issue Sep 1, 2020 · 3 comments · May be fixed by #521
Open

Support specifying a midpoint / etc. in quantitative color scaling #365

fedarko opened this issue Sep 1, 2020 · 3 comments · May be fixed by #521

Comments

@fedarko
Copy link
Collaborator

fedarko commented Sep 1, 2020

When drawing barplots of things like differentials using a diverging color map, it would be nice to be able to say "ok, the midpoint of this color map should coincide with a value = 0", to ensure that things are colored consistently even if there are outliers. I think iTOL supports something like this?

@ElDeveloper
Copy link
Member

In addition it would also be nice to set the high and low values so that anything above/below is capped. This should help with outliers.

@fedarko fedarko self-assigned this Sep 26, 2020
@gibsramen
Copy link
Collaborator

Bumping this is as it came up while making the slide for lab meeting presentation. iTOL allows something similar to what @fedarko & @ElDeveloper mentioned. Basically, you can specify the midpoint and endpoint colors but not where the midpoint and endpoints actually occur. I think it makes more sense to allow the user to set the values themselves.

image

For the below tree (differentials), the midpoint being -1.14 pretty substantially hampers interpretation when 0 is the "average" log-fold change.

image

@fedarko
Copy link
Collaborator Author

fedarko commented Nov 18, 2020

Thanks @gibsramen. Agreed that this would be a really useful feature to have.

Adding UI controls to the continuous coloring sections that let the user define the exact "domain" of the color map based on at least two (but ideally arbitrarily many) numerical values should be enough for most use cases, I think. chroma.js' chroma.scale.domain() function supports this really nicely (and the "capping" happens by default, so e.g. if you pass in [-2, 2] as the domain for a scale, -5 just maps to whatever -2's color is).

image

There would be lots of fancier things possible here (e.g. letting the user specify arbitrary colors alongside the numbers in order to create a scale without using any of the preset color maps in Empress, similarly to how iTOL works), but I think for a first pass just the customization described above would be useful.

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

Successfully merging a pull request may close this issue.

3 participants