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 "flipping" continuous color maps #418

Closed
fedarko opened this issue Oct 13, 2020 · 3 comments
Closed

Support "flipping" continuous color maps #418

fedarko opened this issue Oct 13, 2020 · 3 comments

Comments

@fedarko
Copy link
Collaborator

fedarko commented Oct 13, 2020

So that e.g. viridis could go from yellow to purple rather than purple to yellow. This would add some more variety to the color options present in Empress.

The changes here would mostly involve the Colorer.js module within Empress, as well as some additional changes to the HTML to involve adding a UI element (checkbox?) that allows users to toggle whether or not the color map is reversed. I think this might be as simple as changing [min, max] to [max, min] within this block of code:

var nums = _.map(split.numeric, parseFloat);
var min = _.min(nums);
var max = _.max(nums);
var interpolator = chroma.scale(this.color).domain([min, max]);
_.each(split.numeric, function (n) {
scope.__valueToColor[n] = interpolator(parseFloat(n));
});

This seems to be how the Chroma.js docs recommend doing this, at least -- see the section around here, right around where it says "To reverse the colors ..."

For reference: brought up by @kwcantrell this morning. We talked about reversing color maps in the context of Qurro a while back at biocore/qurro#277, but I haven't got around to doing that yet :(

@gwarmstrong
Copy link
Member

Can I grab this one?

@kwcantrell
Copy link
Collaborator

thanks @gwarmstrong! This will a nice feature to have.

@fedarko
Copy link
Collaborator Author

fedarko commented Oct 19, 2020

(Closed by #423.)

@fedarko fedarko closed this as completed Oct 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants