palette:scale-gradient
palette:scale-gradient rgb-color-list number range1 range2
Reports an RGB color proportional to number using a gradient generated with rgb-color-list. The rgb-color-list is a list containing NL or RGB colors: e.g. NL1 r1 g1 b1 r2 g2 b2 r3 g3 b3 NL2 ….
When range1 is less than or equal to range2, the color will be directly mapped to gradient colors. When range2 is less than range1, the color gradient is inverted.
Let min-range be the minimum of range1 and range2. If number is less than or equal to min-range, then the result is the same as if number was equal to min-range.
Let max-range be the maximum of range1 and range2. If number is greater than max-range, then the result is the same as if number was equal to max-range.
Example:
ask patches
[
set pcolor palette:scale-gradient [[255 0 0] [0 0 255]] pxcor min-pxcor max-pxcor
]
;; colors each patch with a color proportional to the gradient