作为我正在研究的数据可视化应用程序的一部分,我遇到了一些奇怪的错误,或者我从根本上不理解某些东西.
我的应用程序具有代码,该代码采用表示颜色标量的数据结构并将它们转换为带有数字并返回颜色RGB值的散列的函数.
渐变和范围颜色标量都实现了:
{:type :gradient
:scale [{:bound 0 :r 0 :g 0 :b 0}
{:bound 1 :r 255 :g 0 :b 0}
{:bound 2 :r 0 :g 255 :b 0}]}
{:type :range
:scale [{:bound [[< 0]] :r 250 :g 250 :b 250}
{:bound [[>= 0] [< 1]] :r 0 :g 0 :b 0}
{:bound [[>= 1] [< 2]] :r 255 :g 0 :b 0}
{:bound [[>= 2]] :r 0 :g 255 :b 0}}]
Run Code Online (Sandbox Code Playgroud)
有些功能可以将这些功能转化为功能,其用法类似于以下内容:
((create-colorscale-fn **GRADIENT-MAP**) 1.5) => {:r 128 …Run Code Online (Sandbox Code Playgroud)