Navigation
Synopsis Compute a color scale for range of values.
Function Color(&T <: num) colorScale(list[&T <: num] values, Color from, Color to)
Description Given a list of numbers values, colorScale returns a function that maps these numbers to a color scale between the colors from and to.
Examples
observed = [10, 20, -50, 13, -40, 25];
cscale = colorScale(observed, color("green", 0.5), color("red", 0.8));
boxes = [ box( text("<v>"), size(50), fillColor(cscale(v))) | v <- observed ];
render(hcat(boxes));
gives h1
Is this page unclear, or have you spotted an error? Please add a comment below and help us to improve it. For all other questions and remarks, visit ask.rascal-mpl.org.