Map to Gradient
Remaps a list of numbers into a gradient of colors.
Overview
Remaps a list of numbers into a gradient of colors.
Inputs (3)
- Values (Number): List of numbers to map to colors.
- Source Domain (Interval): Optional source domain. If left empty, it automatically uses the min and max of the input values.
- Colors (Colour): List of colors to form the gradient. Defaults to a standard Blue-to-Red spectrum if empty.
Outputs (1)
- Mapped Colors (Colour): The resulting interpolated colors.
Method, assumptions and simplifications
The same notes appear in the component's Info output.
Method
- Each value is normalised to t = (value - T0) / (T1 - T0) of the Source Domain, from its start to its end, and clamped to 0-1; a reversed domain (for example 10 to 0) flips the gradient. Without a domain the minimum and maximum of the values are used, ignoring NaN and infinite values.
- NaN values get the first colour and a warning.
- t picks a position along the colour list and the colour is linearly interpolated in RGB between the two neighbouring colours (default blue, cyan, lime, yellow, red).
Assumptions
- Colours are listed from low to high values.
Simplifications and limits
- Linear RGB blend; values outside the domain take the end colours.