biocore/qurro

support reversed color schemes

開放

#277 建立於 2020年2月26日

 (3 則留言) (2 個反應) (0 位負責人)JavaScript (10 個分叉)auto 404
enhancementgood first issue

倉庫指標

星標
 (35 顆星)
PR 合併指標
 (30 天內沒有已合併 PR)

描述

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

貢獻者指南