biocore/qurro

support reversed color schemes

Open

#277 opened on Feb 26, 2020

 (3 comments) (2 reactions) (0 assignees)JavaScript (10 forks)auto 404
enhancementgood first issue

Repository metrics

Stars
 (35 stars)
PR merge metrics
 (PR metrics pending)

Description

It would be awesome if color schemes could be inverted, e.g.,

Screen Shot 2020-02-26 at 10 32 53 AM

from the red sea example. In the picture, I am using redblue color scheme, but due to ordering, colder temperatures are red and warmer temperatures are blue, which is a little counter-intuitive and it would theoretically be nice to display the legend with the opposite color ordering. There is no bluered color scheme in vega-lite, so in order to get the color scheme inverted, you have to invert the upper and lower bound of the domain, something like adding domain=[1, 0] to the scale call:

https://github.com/biocore/qurro/blob/a37037bdf83770349e1e05f363692c8c202db173/qurro/generate.py#L289

I think user-side, this would look something like having a checkbox titled Invert quantitative color scheme, that you can use to apply the domain change.

This issue https://github.com/altair-viz/altair/issues/1068 may be informative

Contributor guide